Free cookie consent management tool by TermsFeed Policy Generator

source: branches/1888_OaaS/HeuristicLab.Services.Optimization.Web/Scripts/jquery-1.5.1.js @ 18078

Last change on this file since 18078 was 8384, checked in by fschoepp, 12 years ago

#1888:

  • Created a project which contains the back-end controller for the Optimization WebSite
  • Added a WCF-back-end-controller which generates all available optimization problems (currently in-memory solution: PlaceholderControllerService.cs)
  • Created a WebRole using ASP.NET MVC 3 for the Optimization Web Site
  • WebSite authenticates users with the HeuristicLab.Authentication membership provider and database
  • WebSite crawls and displays all available optimization scenarios by using the WCF-back-end controller (test with: http://localhost:.../optimization)
File size: 212.3 KB
Line 
1/*!
2* Note: While Microsoft is not the author of this file, Microsoft is
3* offering you a license subject to the terms of the Microsoft Software
4* License Terms for Microsoft ASP.NET Model View Controller 3.
5* Microsoft reserves all other rights. The notices below are provided
6* for informational purposes only and are not the license terms under
7* which Microsoft distributed this file.
8*
9* jQuery JavaScript Library v1.5.1
10* http://jquery.com/
11* Copyright 2011, John Resig
12*
13* Includes Sizzle.js
14* http://sizzlejs.com/
15* Copyright 2011, The Dojo Foundation
16*
17* Date: Thu Nov 11 19:04:53 2010 -0500
18*/
19(function( window, undefined ) {
20
21// Use the correct document accordingly with window argument (sandbox)
22var document = window.document;
23var jQuery = (function() {
24
25// Define a local copy of jQuery
26var jQuery = function( selector, context ) {
27    // The jQuery object is actually just the init constructor 'enhanced'
28    return new jQuery.fn.init( selector, context, rootjQuery );
29  },
30
31  // Map over jQuery in case of overwrite
32  _jQuery = window.jQuery,
33
34  // Map over the $ in case of overwrite
35  _$ = window.$,
36
37  // A central reference to the root jQuery(document)
38  rootjQuery,
39
40  // A simple way to check for HTML strings or ID strings
41  // (both of which we optimize for)
42  quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
43
44  // Check if a string has a non-whitespace character in it
45  rnotwhite = /\S/,
46
47  // Used for trimming whitespace
48  trimLeft = /^\s+/,
49  trimRight = /\s+$/,
50
51  // Check for digits
52  rdigit = /\d/,
53
54  // Match a standalone tag
55  rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
56
57  // JSON RegExp
58  rvalidchars = /^[\],:{}\s]*$/,
59  rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
60  rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
61  rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
62
63  // Useragent RegExp
64  rwebkit = /(webkit)[ \/]([\w.]+)/,
65  ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
66  rmsie = /(msie) ([\w.]+)/,
67  rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
68
69  // Keep a UserAgent string for use with jQuery.browser
70  userAgent = navigator.userAgent,
71
72  // For matching the engine and version of the browser
73  browserMatch,
74
75  // Has the ready events already been bound?
76  readyBound = false,
77
78  // The deferred used on DOM ready
79  readyList,
80
81  // Promise methods
82  promiseMethods = "then done fail isResolved isRejected promise".split( " " ),
83
84  // The ready event handler
85  DOMContentLoaded,
86
87  // Save a reference to some core methods
88  toString = Object.prototype.toString,
89  hasOwn = Object.prototype.hasOwnProperty,
90  push = Array.prototype.push,
91  slice = Array.prototype.slice,
92  trim = String.prototype.trim,
93  indexOf = Array.prototype.indexOf,
94
95  // [[Class]] -> type pairs
96  class2type = {};
97
98jQuery.fn = jQuery.prototype = {
99  constructor: jQuery,
100  init: function( selector, context, rootjQuery ) {
101    var match, elem, ret, doc;
102
103    // Handle $(""), $(null), or $(undefined)
104    if ( !selector ) {
105      return this;
106    }
107
108    // Handle $(DOMElement)
109    if ( selector.nodeType ) {
110      this.context = this[0] = selector;
111      this.length = 1;
112      return this;
113    }
114
115    // The body element only exists once, optimize finding it
116    if ( selector === "body" && !context && document.body ) {
117      this.context = document;
118      this[0] = document.body;
119      this.selector = "body";
120      this.length = 1;
121      return this;
122    }
123
124    // Handle HTML strings
125    if ( typeof selector === "string" ) {
126      // Are we dealing with HTML string or an ID?
127      match = quickExpr.exec( selector );
128
129      // Verify a match, and that no context was specified for #id
130      if ( match && (match[1] || !context) ) {
131
132        // HANDLE: $(html) -> $(array)
133        if ( match[1] ) {
134          context = context instanceof jQuery ? context[0] : context;
135          doc = (context ? context.ownerDocument || context : document);
136
137          // If a single string is passed in and it's a single tag
138          // just do a createElement and skip the rest
139          ret = rsingleTag.exec( selector );
140
141          if ( ret ) {
142            if ( jQuery.isPlainObject( context ) ) {
143              selector = [ document.createElement( ret[1] ) ];
144              jQuery.fn.attr.call( selector, context, true );
145
146            } else {
147              selector = [ doc.createElement( ret[1] ) ];
148            }
149
150          } else {
151            ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
152            selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
153          }
154
155          return jQuery.merge( this, selector );
156
157        // HANDLE: $("#id")
158        } else {
159          elem = document.getElementById( match[2] );
160
161          // Check parentNode to catch when Blackberry 4.6 returns
162          // nodes that are no longer in the document #6963
163          if ( elem && elem.parentNode ) {
164            // Handle the case where IE and Opera return items
165            // by name instead of ID
166            if ( elem.id !== match[2] ) {
167              return rootjQuery.find( selector );
168            }
169
170            // Otherwise, we inject the element directly into the jQuery object
171            this.length = 1;
172            this[0] = elem;
173          }
174
175          this.context = document;
176          this.selector = selector;
177          return this;
178        }
179
180      // HANDLE: $(expr, $(...))
181      } else if ( !context || context.jquery ) {
182        return (context || rootjQuery).find( selector );
183
184      // HANDLE: $(expr, context)
185      // (which is just equivalent to: $(context).find(expr)
186      } else {
187        return this.constructor( context ).find( selector );
188      }
189
190    // HANDLE: $(function)
191    // Shortcut for document ready
192    } else if ( jQuery.isFunction( selector ) ) {
193      return rootjQuery.ready( selector );
194    }
195
196    if (selector.selector !== undefined) {
197      this.selector = selector.selector;
198      this.context = selector.context;
199    }
200
201    return jQuery.makeArray( selector, this );
202  },
203
204  // Start with an empty selector
205  selector: "",
206
207  // The current version of jQuery being used
208  jquery: "1.5.1",
209
210  // The default length of a jQuery object is 0
211  length: 0,
212
213  // The number of elements contained in the matched element set
214  size: function() {
215    return this.length;
216  },
217
218  toArray: function() {
219    return slice.call( this, 0 );
220  },
221
222  // Get the Nth element in the matched element set OR
223  // Get the whole matched element set as a clean array
224  get: function( num ) {
225    return num == null ?
226
227      // Return a 'clean' array
228      this.toArray() :
229
230      // Return just the object
231      ( num < 0 ? this[ this.length + num ] : this[ num ] );
232  },
233
234  // Take an array of elements and push it onto the stack
235  // (returning the new matched element set)
236  pushStack: function( elems, name, selector ) {
237    // Build a new jQuery matched element set
238    var ret = this.constructor();
239
240    if ( jQuery.isArray( elems ) ) {
241      push.apply( ret, elems );
242
243    } else {
244      jQuery.merge( ret, elems );
245    }
246
247    // Add the old object onto the stack (as a reference)
248    ret.prevObject = this;
249
250    ret.context = this.context;
251
252    if ( name === "find" ) {
253      ret.selector = this.selector + (this.selector ? " " : "") + selector;
254    } else if ( name ) {
255      ret.selector = this.selector + "." + name + "(" + selector + ")";
256    }
257
258    // Return the newly-formed element set
259    return ret;
260  },
261
262  // Execute a callback for every element in the matched set.
263  // (You can seed the arguments with an array of args, but this is
264  // only used internally.)
265  each: function( callback, args ) {
266    return jQuery.each( this, callback, args );
267  },
268
269  ready: function( fn ) {
270    // Attach the listeners
271    jQuery.bindReady();
272
273    // Add the callback
274    readyList.done( fn );
275
276    return this;
277  },
278
279  eq: function( i ) {
280    return i === -1 ?
281      this.slice( i ) :
282      this.slice( i, +i + 1 );
283  },
284
285  first: function() {
286    return this.eq( 0 );
287  },
288
289  last: function() {
290    return this.eq( -1 );
291  },
292
293  slice: function() {
294    return this.pushStack( slice.apply( this, arguments ),
295      "slice", slice.call(arguments).join(",") );
296  },
297
298  map: function( callback ) {
299    return this.pushStack( jQuery.map(this, function( elem, i ) {
300      return callback.call( elem, i, elem );
301    }));
302  },
303
304  end: function() {
305    return this.prevObject || this.constructor(null);
306  },
307
308  // For internal use only.
309  // Behaves like an Array's method, not like a jQuery method.
310  push: push,
311  sort: [].sort,
312  splice: [].splice
313};
314
315// Give the init function the jQuery prototype for later instantiation
316jQuery.fn.init.prototype = jQuery.fn;
317
318jQuery.extend = jQuery.fn.extend = function() {
319  var options, name, src, copy, copyIsArray, clone,
320    target = arguments[0] || {},
321    i = 1,
322    length = arguments.length,
323    deep = false;
324
325  // Handle a deep copy situation
326  if ( typeof target === "boolean" ) {
327    deep = target;
328    target = arguments[1] || {};
329    // skip the boolean and the target
330    i = 2;
331  }
332
333  // Handle case when target is a string or something (possible in deep copy)
334  if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
335    target = {};
336  }
337
338  // extend jQuery itself if only one argument is passed
339  if ( length === i ) {
340    target = this;
341    --i;
342  }
343
344  for ( ; i < length; i++ ) {
345    // Only deal with non-null/undefined values
346    if ( (options = arguments[ i ]) != null ) {
347      // Extend the base object
348      for ( name in options ) {
349        src = target[ name ];
350        copy = options[ name ];
351
352        // Prevent never-ending loop
353        if ( target === copy ) {
354          continue;
355        }
356
357        // Recurse if we're merging plain objects or arrays
358        if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
359          if ( copyIsArray ) {
360            copyIsArray = false;
361            clone = src && jQuery.isArray(src) ? src : [];
362
363          } else {
364            clone = src && jQuery.isPlainObject(src) ? src : {};
365          }
366
367          // Never move original objects, clone them
368          target[ name ] = jQuery.extend( deep, clone, copy );
369
370        // Don't bring in undefined values
371        } else if ( copy !== undefined ) {
372          target[ name ] = copy;
373        }
374      }
375    }
376  }
377
378  // Return the modified object
379  return target;
380};
381
382jQuery.extend({
383  noConflict: function( deep ) {
384    window.$ = _$;
385
386    if ( deep ) {
387      window.jQuery = _jQuery;
388    }
389
390    return jQuery;
391  },
392
393  // Is the DOM ready to be used? Set to true once it occurs.
394  isReady: false,
395
396  // A counter to track how many items to wait for before
397  // the ready event fires. See #6781
398  readyWait: 1,
399
400  // Handle when the DOM is ready
401  ready: function( wait ) {
402    // A third-party is pushing the ready event forwards
403    if ( wait === true ) {
404      jQuery.readyWait--;
405    }
406
407    // Make sure that the DOM is not already loaded
408    if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
409      // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
410      if ( !document.body ) {
411        return setTimeout( jQuery.ready, 1 );
412      }
413
414      // Remember that the DOM is ready
415      jQuery.isReady = true;
416
417      // If a normal DOM Ready event fired, decrement, and wait if need be
418      if ( wait !== true && --jQuery.readyWait > 0 ) {
419        return;
420      }
421
422      // If there are functions bound, to execute
423      readyList.resolveWith( document, [ jQuery ] );
424
425      // Trigger any bound ready events
426      if ( jQuery.fn.trigger ) {
427        jQuery( document ).trigger( "ready" ).unbind( "ready" );
428      }
429    }
430  },
431
432  bindReady: function() {
433    if ( readyBound ) {
434      return;
435    }
436
437    readyBound = true;
438
439    // Catch cases where $(document).ready() is called after the
440    // browser event has already occurred.
441    if ( document.readyState === "complete" ) {
442      // Handle it asynchronously to allow scripts the opportunity to delay ready
443      return setTimeout( jQuery.ready, 1 );
444    }
445
446    // Mozilla, Opera and webkit nightlies currently support this event
447    if ( document.addEventListener ) {
448      // Use the handy event callback
449      document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
450
451      // A fallback to window.onload, that will always work
452      window.addEventListener( "load", jQuery.ready, false );
453
454    // If IE event model is used
455    } else if ( document.attachEvent ) {
456      // ensure firing before onload,
457      // maybe late but safe also for iframes
458      document.attachEvent("onreadystatechange", DOMContentLoaded);
459
460      // A fallback to window.onload, that will always work
461      window.attachEvent( "onload", jQuery.ready );
462
463      // If IE and not a frame
464      // continually check to see if the document is ready
465      var toplevel = false;
466
467      try {
468        toplevel = window.frameElement == null;
469      } catch(e) {}
470
471      if ( document.documentElement.doScroll && toplevel ) {
472        doScrollCheck();
473      }
474    }
475  },
476
477  // See test/unit/core.js for details concerning isFunction.
478  // Since version 1.3, DOM methods and functions like alert
479  // aren't supported. They return false on IE (#2968).
480  isFunction: function( obj ) {
481    return jQuery.type(obj) === "function";
482  },
483
484  isArray: Array.isArray || function( obj ) {
485    return jQuery.type(obj) === "array";
486  },
487
488  // A crude way of determining if an object is a window
489  isWindow: function( obj ) {
490    return obj && typeof obj === "object" && "setInterval" in obj;
491  },
492
493  isNaN: function( obj ) {
494    return obj == null || !rdigit.test( obj ) || isNaN( obj );
495  },
496
497  type: function( obj ) {
498    return obj == null ?
499      String( obj ) :
500      class2type[ toString.call(obj) ] || "object";
501  },
502
503  isPlainObject: function( obj ) {
504    // Must be an Object.
505    // Because of IE, we also have to check the presence of the constructor property.
506    // Make sure that DOM nodes and window objects don't pass through, as well
507    if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
508      return false;
509    }
510
511    // Not own constructor property must be Object
512    if ( obj.constructor &&
513      !hasOwn.call(obj, "constructor") &&
514      !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
515      return false;
516    }
517
518    // Own properties are enumerated firstly, so to speed up,
519    // if last one is own, then all properties are own.
520
521    var key;
522    for ( key in obj ) {}
523
524    return key === undefined || hasOwn.call( obj, key );
525  },
526
527  isEmptyObject: function( obj ) {
528    for ( var name in obj ) {
529      return false;
530    }
531    return true;
532  },
533
534  error: function( msg ) {
535    throw msg;
536  },
537
538  parseJSON: function( data ) {
539    if ( typeof data !== "string" || !data ) {
540      return null;
541    }
542
543    // Make sure leading/trailing whitespace is removed (IE can't handle it)
544    data = jQuery.trim( data );
545
546    // Make sure the incoming data is actual JSON
547    // Logic borrowed from http://json.org/json2.js
548    if ( rvalidchars.test(data.replace(rvalidescape, "@")
549      .replace(rvalidtokens, "]")
550      .replace(rvalidbraces, "")) ) {
551
552      // Try to use the native JSON parser first
553      return window.JSON && window.JSON.parse ?
554        window.JSON.parse( data ) :
555        (new Function("return " + data))();
556
557    } else {
558      jQuery.error( "Invalid JSON: " + data );
559    }
560  },
561
562  // Cross-browser xml parsing
563  // (xml & tmp used internally)
564  parseXML: function( data , xml , tmp ) {
565
566    if ( window.DOMParser ) { // Standard
567      tmp = new DOMParser();
568      xml = tmp.parseFromString( data , "text/xml" );
569    } else { // IE
570      xml = new ActiveXObject( "Microsoft.XMLDOM" );
571      xml.async = "false";
572      xml.loadXML( data );
573    }
574
575    tmp = xml.documentElement;
576
577    if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
578      jQuery.error( "Invalid XML: " + data );
579    }
580
581    return xml;
582  },
583
584  noop: function() {},
585
586  // Evalulates a script in a global context
587  globalEval: function( data ) {
588    if ( data && rnotwhite.test(data) ) {
589      // Inspired by code by Andrea Giammarchi
590      // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
591      var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
592        script = document.createElement( "script" );
593
594      if ( jQuery.support.scriptEval() ) {
595        script.appendChild( document.createTextNode( data ) );
596      } else {
597        script.text = data;
598      }
599
600      // Use insertBefore instead of appendChild to circumvent an IE6 bug.
601      // This arises when a base node is used (#2709).
602      head.insertBefore( script, head.firstChild );
603      head.removeChild( script );
604    }
605  },
606
607  nodeName: function( elem, name ) {
608    return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
609  },
610
611  // args is for internal usage only
612  each: function( object, callback, args ) {
613    var name, i = 0,
614      length = object.length,
615      isObj = length === undefined || jQuery.isFunction(object);
616
617    if ( args ) {
618      if ( isObj ) {
619        for ( name in object ) {
620          if ( callback.apply( object[ name ], args ) === false ) {
621            break;
622          }
623        }
624      } else {
625        for ( ; i < length; ) {
626          if ( callback.apply( object[ i++ ], args ) === false ) {
627            break;
628          }
629        }
630      }
631
632    // A special, fast, case for the most common use of each
633    } else {
634      if ( isObj ) {
635        for ( name in object ) {
636          if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
637            break;
638          }
639        }
640      } else {
641        for ( var value = object[0];
642          i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
643      }
644    }
645
646    return object;
647  },
648
649  // Use native String.trim function wherever possible
650  trim: trim ?
651    function( text ) {
652      return text == null ?
653        "" :
654        trim.call( text );
655    } :
656
657    // Otherwise use our own trimming functionality
658    function( text ) {
659      return text == null ?
660        "" :
661        text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
662    },
663
664  // results is for internal usage only
665  makeArray: function( array, results ) {
666    var ret = results || [];
667
668    if ( array != null ) {
669      // The window, strings (and functions) also have 'length'
670      // The extra typeof function check is to prevent crashes
671      // in Safari 2 (See: #3039)
672      // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
673      var type = jQuery.type(array);
674
675      if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
676        push.call( ret, array );
677      } else {
678        jQuery.merge( ret, array );
679      }
680    }
681
682    return ret;
683  },
684
685  inArray: function( elem, array ) {
686    if ( array.indexOf ) {
687      return array.indexOf( elem );
688    }
689
690    for ( var i = 0, length = array.length; i < length; i++ ) {
691      if ( array[ i ] === elem ) {
692        return i;
693      }
694    }
695
696    return -1;
697  },
698
699  merge: function( first, second ) {
700    var i = first.length,
701      j = 0;
702
703    if ( typeof second.length === "number" ) {
704      for ( var l = second.length; j < l; j++ ) {
705        first[ i++ ] = second[ j ];
706      }
707
708    } else {
709      while ( second[j] !== undefined ) {
710        first[ i++ ] = second[ j++ ];
711      }
712    }
713
714    first.length = i;
715
716    return first;
717  },
718
719  grep: function( elems, callback, inv ) {
720    var ret = [], retVal;
721    inv = !!inv;
722
723    // Go through the array, only saving the items
724    // that pass the validator function
725    for ( var i = 0, length = elems.length; i < length; i++ ) {
726      retVal = !!callback( elems[ i ], i );
727      if ( inv !== retVal ) {
728        ret.push( elems[ i ] );
729      }
730    }
731
732    return ret;
733  },
734
735  // arg is for internal usage only
736  map: function( elems, callback, arg ) {
737    var ret = [], value;
738
739    // Go through the array, translating each of the items to their
740    // new value (or values).
741    for ( var i = 0, length = elems.length; i < length; i++ ) {
742      value = callback( elems[ i ], i, arg );
743
744      if ( value != null ) {
745        ret[ ret.length ] = value;
746      }
747    }
748
749    // Flatten any nested arrays
750    return ret.concat.apply( [], ret );
751  },
752
753  // A global GUID counter for objects
754  guid: 1,
755
756  proxy: function( fn, proxy, thisObject ) {
757    if ( arguments.length === 2 ) {
758      if ( typeof proxy === "string" ) {
759        thisObject = fn;
760        fn = thisObject[ proxy ];
761        proxy = undefined;
762
763      } else if ( proxy && !jQuery.isFunction( proxy ) ) {
764        thisObject = proxy;
765        proxy = undefined;
766      }
767    }
768
769    if ( !proxy && fn ) {
770      proxy = function() {
771        return fn.apply( thisObject || this, arguments );
772      };
773    }
774
775    // Set the guid of unique handler to the same of original handler, so it can be removed
776    if ( fn ) {
777      proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
778    }
779
780    // So proxy can be declared as an argument
781    return proxy;
782  },
783
784  // Mutifunctional method to get and set values to a collection
785  // The value/s can be optionally by executed if its a function
786  access: function( elems, key, value, exec, fn, pass ) {
787    var length = elems.length;
788
789    // Setting many attributes
790    if ( typeof key === "object" ) {
791      for ( var k in key ) {
792        jQuery.access( elems, k, key[k], exec, fn, value );
793      }
794      return elems;
795    }
796
797    // Setting one attribute
798    if ( value !== undefined ) {
799      // Optionally, function values get executed if exec is true
800      exec = !pass && exec && jQuery.isFunction(value);
801
802      for ( var i = 0; i < length; i++ ) {
803        fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
804      }
805
806      return elems;
807    }
808
809    // Getting an attribute
810    return length ? fn( elems[0], key ) : undefined;
811  },
812
813  now: function() {
814    return (new Date()).getTime();
815  },
816
817  // Create a simple deferred (one callbacks list)
818  _Deferred: function() {
819    var // callbacks list
820      callbacks = [],
821      // stored [ context , args ]
822      fired,
823      // to avoid firing when already doing so
824      firing,
825      // flag to know if the deferred has been cancelled
826      cancelled,
827      // the deferred itself
828      deferred  = {
829
830        // done( f1, f2, ...)
831        done: function() {
832          if ( !cancelled ) {
833            var args = arguments,
834              i,
835              length,
836              elem,
837              type,
838              _fired;
839            if ( fired ) {
840              _fired = fired;
841              fired = 0;
842            }
843            for ( i = 0, length = args.length; i < length; i++ ) {
844              elem = args[ i ];
845              type = jQuery.type( elem );
846              if ( type === "array" ) {
847                deferred.done.apply( deferred, elem );
848              } else if ( type === "function" ) {
849                callbacks.push( elem );
850              }
851            }
852            if ( _fired ) {
853              deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
854            }
855          }
856          return this;
857        },
858
859        // resolve with given context and args
860        resolveWith: function( context, args ) {
861          if ( !cancelled && !fired && !firing ) {
862            firing = 1;
863            try {
864              while( callbacks[ 0 ] ) {
865                callbacks.shift().apply( context, args );
866              }
867            }
868            // We have to add a catch block for
869            // IE prior to 8 or else the finally
870            // block will never get executed
871            catch (e) {
872              throw e;
873            }
874            finally {
875              fired = [ context, args ];
876              firing = 0;
877            }
878          }
879          return this;
880        },
881
882        // resolve with this as context and given arguments
883        resolve: function() {
884          deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments );
885          return this;
886        },
887
888        // Has this deferred been resolved?
889        isResolved: function() {
890          return !!( firing || fired );
891        },
892
893        // Cancel
894        cancel: function() {
895          cancelled = 1;
896          callbacks = [];
897          return this;
898        }
899      };
900
901    return deferred;
902  },
903
904  // Full fledged deferred (two callbacks list)
905  Deferred: function( func ) {
906    var deferred = jQuery._Deferred(),
907      failDeferred = jQuery._Deferred(),
908      promise;
909    // Add errorDeferred methods, then and promise
910    jQuery.extend( deferred, {
911      then: function( doneCallbacks, failCallbacks ) {
912        deferred.done( doneCallbacks ).fail( failCallbacks );
913        return this;
914      },
915      fail: failDeferred.done,
916      rejectWith: failDeferred.resolveWith,
917      reject: failDeferred.resolve,
918      isRejected: failDeferred.isResolved,
919      // Get a promise for this deferred
920      // If obj is provided, the promise aspect is added to the object
921      promise: function( obj ) {
922        if ( obj == null ) {
923          if ( promise ) {
924            return promise;
925          }
926          promise = obj = {};
927        }
928        var i = promiseMethods.length;
929        while( i-- ) {
930          obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
931        }
932        return obj;
933      }
934    } );
935    // Make sure only one callback list will be used
936    deferred.done( failDeferred.cancel ).fail( deferred.cancel );
937    // Unexpose cancel
938    delete deferred.cancel;
939    // Call given func if any
940    if ( func ) {
941      func.call( deferred, deferred );
942    }
943    return deferred;
944  },
945
946  // Deferred helper
947  when: function( object ) {
948    var lastIndex = arguments.length,
949      deferred = lastIndex <= 1 && object && jQuery.isFunction( object.promise ) ?
950        object :
951        jQuery.Deferred(),
952      promise = deferred.promise();
953
954    if ( lastIndex > 1 ) {
955      var array = slice.call( arguments, 0 ),
956        count = lastIndex,
957        iCallback = function( index ) {
958          return function( value ) {
959            array[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;
960            if ( !( --count ) ) {
961              deferred.resolveWith( promise, array );
962            }
963          };
964        };
965      while( ( lastIndex-- ) ) {
966        object = array[ lastIndex ];
967        if ( object && jQuery.isFunction( object.promise ) ) {
968          object.promise().then( iCallback(lastIndex), deferred.reject );
969        } else {
970          --count;
971        }
972      }
973      if ( !count ) {
974        deferred.resolveWith( promise, array );
975      }
976    } else if ( deferred !== object ) {
977      deferred.resolve( object );
978    }
979    return promise;
980  },
981
982  // Use of jQuery.browser is frowned upon.
983  // More details: http://docs.jquery.com/Utilities/jQuery.browser
984  uaMatch: function( ua ) {
985    ua = ua.toLowerCase();
986
987    var match = rwebkit.exec( ua ) ||
988      ropera.exec( ua ) ||
989      rmsie.exec( ua ) ||
990      ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
991      [];
992
993    return { browser: match[1] || "", version: match[2] || "0" };
994  },
995
996  sub: function() {
997    function jQuerySubclass( selector, context ) {
998      return new jQuerySubclass.fn.init( selector, context );
999    }
1000    jQuery.extend( true, jQuerySubclass, this );
1001    jQuerySubclass.superclass = this;
1002    jQuerySubclass.fn = jQuerySubclass.prototype = this();
1003    jQuerySubclass.fn.constructor = jQuerySubclass;
1004    jQuerySubclass.subclass = this.subclass;
1005    jQuerySubclass.fn.init = function init( selector, context ) {
1006      if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {
1007        context = jQuerySubclass(context);
1008      }
1009
1010      return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );
1011    };
1012    jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
1013    var rootjQuerySubclass = jQuerySubclass(document);
1014    return jQuerySubclass;
1015  },
1016
1017  browser: {}
1018});
1019
1020// Create readyList deferred
1021readyList = jQuery._Deferred();
1022
1023// Populate the class2type map
1024jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
1025  class2type[ "[object " + name + "]" ] = name.toLowerCase();
1026});
1027
1028browserMatch = jQuery.uaMatch( userAgent );
1029if ( browserMatch.browser ) {
1030  jQuery.browser[ browserMatch.browser ] = true;
1031  jQuery.browser.version = browserMatch.version;
1032}
1033
1034// Deprecated, use jQuery.browser.webkit instead
1035if ( jQuery.browser.webkit ) {
1036  jQuery.browser.safari = true;
1037}
1038
1039if ( indexOf ) {
1040  jQuery.inArray = function( elem, array ) {
1041    return indexOf.call( array, elem );
1042  };
1043}
1044
1045// IE doesn't match non-breaking spaces with \s
1046if ( rnotwhite.test( "\xA0" ) ) {
1047  trimLeft = /^[\s\xA0]+/;
1048  trimRight = /[\s\xA0]+$/;
1049}
1050
1051// All jQuery objects should point back to these
1052rootjQuery = jQuery(document);
1053
1054// Cleanup functions for the document ready method
1055if ( document.addEventListener ) {
1056  DOMContentLoaded = function() {
1057    document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
1058    jQuery.ready();
1059  };
1060
1061} else if ( document.attachEvent ) {
1062  DOMContentLoaded = function() {
1063    // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
1064    if ( document.readyState === "complete" ) {
1065      document.detachEvent( "onreadystatechange", DOMContentLoaded );
1066      jQuery.ready();
1067    }
1068  };
1069}
1070
1071// The DOM ready check for Internet Explorer
1072function doScrollCheck() {
1073  if ( jQuery.isReady ) {
1074    return;
1075  }
1076
1077  try {
1078    // If IE is used, use the trick by Diego Perini
1079    // http://javascript.nwbox.com/IEContentLoaded/
1080    document.documentElement.doScroll("left");
1081  } catch(e) {
1082    setTimeout( doScrollCheck, 1 );
1083    return;
1084  }
1085
1086  // and execute any waiting functions
1087  jQuery.ready();
1088}
1089
1090// Expose jQuery to the global object
1091return jQuery;
1092
1093})();
1094
1095
1096(function() {
1097
1098  jQuery.support = {};
1099
1100  var div = document.createElement("div");
1101
1102  div.style.display = "none";
1103  div.innerHTML = "   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
1104
1105  var all = div.getElementsByTagName("*"),
1106    a = div.getElementsByTagName("a")[0],
1107    select = document.createElement("select"),
1108    opt = select.appendChild( document.createElement("option") ),
1109    input = div.getElementsByTagName("input")[0];
1110
1111  // Can't get basic test support
1112  if ( !all || !all.length || !a ) {
1113    return;
1114  }
1115
1116  jQuery.support = {
1117    // IE strips leading whitespace when .innerHTML is used
1118    leadingWhitespace: div.firstChild.nodeType === 3,
1119
1120    // Make sure that tbody elements aren't automatically inserted
1121    // IE will insert them into empty tables
1122    tbody: !div.getElementsByTagName("tbody").length,
1123
1124    // Make sure that link elements get serialized correctly by innerHTML
1125    // This requires a wrapper element in IE
1126    htmlSerialize: !!div.getElementsByTagName("link").length,
1127
1128    // Get the style information from getAttribute
1129    // (IE uses .cssText insted)
1130    style: /red/.test( a.getAttribute("style") ),
1131
1132    // Make sure that URLs aren't manipulated
1133    // (IE normalizes it by default)
1134    hrefNormalized: a.getAttribute("href") === "/a",
1135
1136    // Make sure that element opacity exists
1137    // (IE uses filter instead)
1138    // Use a regex to work around a WebKit issue. See #5145
1139    opacity: /^0.55$/.test( a.style.opacity ),
1140
1141    // Verify style float existence
1142    // (IE uses styleFloat instead of cssFloat)
1143    cssFloat: !!a.style.cssFloat,
1144
1145    // Make sure that if no value is specified for a checkbox
1146    // that it defaults to "on".
1147    // (WebKit defaults to "" instead)
1148    checkOn: input.value === "on",
1149
1150    // Make sure that a selected-by-default option has a working selected property.
1151    // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
1152    optSelected: opt.selected,
1153
1154    // Will be defined later
1155    deleteExpando: true,
1156    optDisabled: false,
1157    checkClone: false,
1158    noCloneEvent: true,
1159    noCloneChecked: true,
1160    boxModel: null,
1161    inlineBlockNeedsLayout: false,
1162    shrinkWrapBlocks: false,
1163    reliableHiddenOffsets: true
1164  };
1165
1166  input.checked = true;
1167  jQuery.support.noCloneChecked = input.cloneNode( true ).checked;
1168
1169  // Make sure that the options inside disabled selects aren't marked as disabled
1170  // (WebKit marks them as diabled)
1171  select.disabled = true;
1172  jQuery.support.optDisabled = !opt.disabled;
1173
1174  var _scriptEval = null;
1175  jQuery.support.scriptEval = function() {
1176    if ( _scriptEval === null ) {
1177      var root = document.documentElement,
1178        script = document.createElement("script"),
1179        id = "script" + jQuery.now();
1180
1181      try {
1182        script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
1183      } catch(e) {}
1184
1185      root.insertBefore( script, root.firstChild );
1186
1187      // Make sure that the execution of code works by injecting a script
1188      // tag with appendChild/createTextNode
1189      // (IE doesn't support this, fails, and uses .text instead)
1190      if ( window[ id ] ) {
1191        _scriptEval = true;
1192        delete window[ id ];
1193      } else {
1194        _scriptEval = false;
1195      }
1196
1197      root.removeChild( script );
1198      // release memory in IE
1199      root = script = id  = null;
1200    }
1201
1202    return _scriptEval;
1203  };
1204
1205  // Test to see if it's possible to delete an expando from an element
1206  // Fails in Internet Explorer
1207  try {
1208    delete div.test;
1209
1210  } catch(e) {
1211    jQuery.support.deleteExpando = false;
1212  }
1213
1214  if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
1215    div.attachEvent("onclick", function click() {
1216      // Cloning a node shouldn't copy over any
1217      // bound event handlers (IE does this)
1218      jQuery.support.noCloneEvent = false;
1219      div.detachEvent("onclick", click);
1220    });
1221    div.cloneNode(true).fireEvent("onclick");
1222  }
1223
1224  div = document.createElement("div");
1225  div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
1226
1227  var fragment = document.createDocumentFragment();
1228  fragment.appendChild( div.firstChild );
1229
1230  // WebKit doesn't clone checked state correctly in fragments
1231  jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
1232
1233  // Figure out if the W3C box model works as expected
1234  // document.body must exist before we can do this
1235  jQuery(function() {
1236    var div = document.createElement("div"),
1237      body = document.getElementsByTagName("body")[0];
1238
1239    // Frameset documents with no body should not run this code
1240    if ( !body ) {
1241      return;
1242    }
1243
1244    div.style.width = div.style.paddingLeft = "1px";
1245    body.appendChild( div );
1246    jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
1247
1248    if ( "zoom" in div.style ) {
1249      // Check if natively block-level elements act like inline-block
1250      // elements when setting their display to 'inline' and giving
1251      // them layout
1252      // (IE < 8 does this)
1253      div.style.display = "inline";
1254      div.style.zoom = 1;
1255      jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
1256
1257      // Check if elements with layout shrink-wrap their children
1258      // (IE 6 does this)
1259      div.style.display = "";
1260      div.innerHTML = "<div style='width:4px;'></div>";
1261      jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
1262    }
1263
1264    div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
1265    var tds = div.getElementsByTagName("td");
1266
1267    // Check if table cells still have offsetWidth/Height when they are set
1268    // to display:none and there are still other visible table cells in a
1269    // table row; if so, offsetWidth/Height are not reliable for use when
1270    // determining if an element has been hidden directly using
1271    // display:none (it is still safe to use offsets if a parent element is
1272    // hidden; don safety goggles and see bug #4512 for more information).
1273    // (only IE 8 fails this test)
1274    jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
1275
1276    tds[0].style.display = "";
1277    tds[1].style.display = "none";
1278
1279    // Check if empty table cells still have offsetWidth/Height
1280    // (IE < 8 fail this test)
1281    jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
1282    div.innerHTML = "";
1283
1284    body.removeChild( div ).style.display = "none";
1285    div = tds = null;
1286  });
1287
1288  // Technique from Juriy Zaytsev
1289  // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
1290  var eventSupported = function( eventName ) {
1291    var el = document.createElement("div");
1292    eventName = "on" + eventName;
1293
1294    // We only care about the case where non-standard event systems
1295    // are used, namely in IE. Short-circuiting here helps us to
1296    // avoid an eval call (in setAttribute) which can cause CSP
1297    // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1298    if ( !el.attachEvent ) {
1299      return true;
1300    }
1301
1302    var isSupported = (eventName in el);
1303    if ( !isSupported ) {
1304      el.setAttribute(eventName, "return;");
1305      isSupported = typeof el[eventName] === "function";
1306    }
1307    el = null;
1308
1309    return isSupported;
1310  };
1311
1312  jQuery.support.submitBubbles = eventSupported("submit");
1313  jQuery.support.changeBubbles = eventSupported("change");
1314
1315  // release memory in IE
1316  div = all = a = null;
1317})();
1318
1319
1320
1321var rbrace = /^(?:\{.*\}|\[.*\])$/;
1322
1323jQuery.extend({
1324  cache: {},
1325
1326  // Please use with caution
1327  uuid: 0,
1328
1329  // Unique for each copy of jQuery on the page
1330  // Non-digits removed to match rinlinejQuery
1331  expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
1332
1333  // The following elements throw uncatchable exceptions if you
1334  // attempt to add expando properties to them.
1335  noData: {
1336    "embed": true,
1337    // Ban all objects except for Flash (which handle expandos)
1338    "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
1339    "applet": true
1340  },
1341
1342  hasData: function( elem ) {
1343    elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1344
1345    return !!elem && !isEmptyDataObject( elem );
1346  },
1347
1348  data: function( elem, name, data, pvt /* Internal Use Only */ ) {
1349    if ( !jQuery.acceptData( elem ) ) {
1350      return;
1351    }
1352
1353    var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
1354
1355      // We have to handle DOM nodes and JS objects differently because IE6-7
1356      // can't GC object references properly across the DOM-JS boundary
1357      isNode = elem.nodeType,
1358
1359      // Only DOM nodes need the global jQuery cache; JS object data is
1360      // attached directly to the object so GC can occur automatically
1361      cache = isNode ? jQuery.cache : elem,
1362
1363      // Only defining an ID for JS objects if its cache already exists allows
1364      // the code to shortcut on the same path as a DOM node with no cache
1365      id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
1366
1367    // Avoid doing any more work than we need to when trying to get data on an
1368    // object that has no data at all
1369    if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
1370      return;
1371    }
1372
1373    if ( !id ) {
1374      // Only DOM nodes need a new unique ID for each element since their data
1375      // ends up in the global cache
1376      if ( isNode ) {
1377        elem[ jQuery.expando ] = id = ++jQuery.uuid;
1378      } else {
1379        id = jQuery.expando;
1380      }
1381    }
1382
1383    if ( !cache[ id ] ) {
1384      cache[ id ] = {};
1385
1386      // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
1387      // metadata on plain JS objects when the object is serialized using
1388      // JSON.stringify
1389      if ( !isNode ) {
1390        cache[ id ].toJSON = jQuery.noop;
1391      }
1392    }
1393
1394    // An object can be passed to jQuery.data instead of a key/value pair; this gets
1395    // shallow copied over onto the existing cache
1396    if ( typeof name === "object" || typeof name === "function" ) {
1397      if ( pvt ) {
1398        cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
1399      } else {
1400        cache[ id ] = jQuery.extend(cache[ id ], name);
1401      }
1402    }
1403
1404    thisCache = cache[ id ];
1405
1406    // Internal jQuery data is stored in a separate object inside the object's data
1407    // cache in order to avoid key collisions between internal data and user-defined
1408    // data
1409    if ( pvt ) {
1410      if ( !thisCache[ internalKey ] ) {
1411        thisCache[ internalKey ] = {};
1412      }
1413
1414      thisCache = thisCache[ internalKey ];
1415    }
1416
1417    if ( data !== undefined ) {
1418      thisCache[ name ] = data;
1419    }
1420
1421    // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
1422    // not attempt to inspect the internal events object using jQuery.data, as this
1423    // internal data object is undocumented and subject to change.
1424    if ( name === "events" && !thisCache[name] ) {
1425      return thisCache[ internalKey ] && thisCache[ internalKey ].events;
1426    }
1427
1428    return getByName ? thisCache[ name ] : thisCache;
1429  },
1430
1431  removeData: function( elem, name, pvt /* Internal Use Only */ ) {
1432    if ( !jQuery.acceptData( elem ) ) {
1433      return;
1434    }
1435
1436    var internalKey = jQuery.expando, isNode = elem.nodeType,
1437
1438      // See jQuery.data for more information
1439      cache = isNode ? jQuery.cache : elem,
1440
1441      // See jQuery.data for more information
1442      id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
1443
1444    // If there is already no cache entry for this object, there is no
1445    // purpose in continuing
1446    if ( !cache[ id ] ) {
1447      return;
1448    }
1449
1450    if ( name ) {
1451      var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
1452
1453      if ( thisCache ) {
1454        delete thisCache[ name ];
1455
1456        // If there is no data left in the cache, we want to continue
1457        // and let the cache object itself get destroyed
1458        if ( !isEmptyDataObject(thisCache) ) {
1459          return;
1460        }
1461      }
1462    }
1463
1464    // See jQuery.data for more information
1465    if ( pvt ) {
1466      delete cache[ id ][ internalKey ];
1467
1468      // Don't destroy the parent cache unless the internal data object
1469      // had been the only thing left in it
1470      if ( !isEmptyDataObject(cache[ id ]) ) {
1471        return;
1472      }
1473    }
1474
1475    var internalCache = cache[ id ][ internalKey ];
1476
1477    // Browsers that fail expando deletion also refuse to delete expandos on
1478    // the window, but it will allow it on all other JS objects; other browsers
1479    // don't care
1480    if ( jQuery.support.deleteExpando || cache != window ) {
1481      delete cache[ id ];
1482    } else {
1483      cache[ id ] = null;
1484    }
1485
1486    // We destroyed the entire user cache at once because it's faster than
1487    // iterating through each key, but we need to continue to persist internal
1488    // data if it existed
1489    if ( internalCache ) {
1490      cache[ id ] = {};
1491      // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
1492      // metadata on plain JS objects when the object is serialized using
1493      // JSON.stringify
1494      if ( !isNode ) {
1495        cache[ id ].toJSON = jQuery.noop;
1496      }
1497
1498      cache[ id ][ internalKey ] = internalCache;
1499
1500    // Otherwise, we need to eliminate the expando on the node to avoid
1501    // false lookups in the cache for entries that no longer exist
1502    } else if ( isNode ) {
1503      // IE does not allow us to delete expando properties from nodes,
1504      // nor does it have a removeAttribute function on Document nodes;
1505      // we must handle all of these cases
1506      if ( jQuery.support.deleteExpando ) {
1507        delete elem[ jQuery.expando ];
1508      } else if ( elem.removeAttribute ) {
1509        elem.removeAttribute( jQuery.expando );
1510      } else {
1511        elem[ jQuery.expando ] = null;
1512      }
1513    }
1514  },
1515
1516  // For internal use only.
1517  _data: function( elem, name, data ) {
1518    return jQuery.data( elem, name, data, true );
1519  },
1520
1521  // A method for determining if a DOM node can handle the data expando
1522  acceptData: function( elem ) {
1523    if ( elem.nodeName ) {
1524      var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
1525
1526      if ( match ) {
1527        return !(match === true || elem.getAttribute("classid") !== match);
1528      }
1529    }
1530
1531    return true;
1532  }
1533});
1534
1535jQuery.fn.extend({
1536  data: function( key, value ) {
1537    var data = null;
1538
1539    if ( typeof key === "undefined" ) {
1540      if ( this.length ) {
1541        data = jQuery.data( this[0] );
1542
1543        if ( this[0].nodeType === 1 ) {
1544          var attr = this[0].attributes, name;
1545          for ( var i = 0, l = attr.length; i < l; i++ ) {
1546            name = attr[i].name;
1547
1548            if ( name.indexOf( "data-" ) === 0 ) {
1549              name = name.substr( 5 );
1550              dataAttr( this[0], name, data[ name ] );
1551            }
1552          }
1553        }
1554      }
1555
1556      return data;
1557
1558    } else if ( typeof key === "object" ) {
1559      return this.each(function() {
1560        jQuery.data( this, key );
1561      });
1562    }
1563
1564    var parts = key.split(".");
1565    parts[1] = parts[1] ? "." + parts[1] : "";
1566
1567    if ( value === undefined ) {
1568      data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
1569
1570      // Try to fetch any internally stored data first
1571      if ( data === undefined && this.length ) {
1572        data = jQuery.data( this[0], key );
1573        data = dataAttr( this[0], key, data );
1574      }
1575
1576      return data === undefined && parts[1] ?
1577        this.data( parts[0] ) :
1578        data;
1579
1580    } else {
1581      return this.each(function() {
1582        var $this = jQuery( this ),
1583          args = [ parts[0], value ];
1584
1585        $this.triggerHandler( "setData" + parts[1] + "!", args );
1586        jQuery.data( this, key, value );
1587        $this.triggerHandler( "changeData" + parts[1] + "!", args );
1588      });
1589    }
1590  },
1591
1592  removeData: function( key ) {
1593    return this.each(function() {
1594      jQuery.removeData( this, key );
1595    });
1596  }
1597});
1598
1599function dataAttr( elem, key, data ) {
1600  // If nothing was found internally, try to fetch any
1601  // data from the HTML5 data-* attribute
1602  if ( data === undefined && elem.nodeType === 1 ) {
1603    data = elem.getAttribute( "data-" + key );
1604
1605    if ( typeof data === "string" ) {
1606      try {
1607        data = data === "true" ? true :
1608        data === "false" ? false :
1609        data === "null" ? null :
1610        !jQuery.isNaN( data ) ? parseFloat( data ) :
1611          rbrace.test( data ) ? jQuery.parseJSON( data ) :
1612          data;
1613      } catch( e ) {}
1614
1615      // Make sure we set the data so it isn't changed later
1616      jQuery.data( elem, key, data );
1617
1618    } else {
1619      data = undefined;
1620    }
1621  }
1622
1623  return data;
1624}
1625
1626// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
1627// property to be considered empty objects; this property always exists in
1628// order to make sure JSON.stringify does not expose internal metadata
1629function isEmptyDataObject( obj ) {
1630  for ( var name in obj ) {
1631    if ( name !== "toJSON" ) {
1632      return false;
1633    }
1634  }
1635
1636  return true;
1637}
1638
1639
1640
1641
1642jQuery.extend({
1643  queue: function( elem, type, data ) {
1644    if ( !elem ) {
1645      return;
1646    }
1647
1648    type = (type || "fx") + "queue";
1649    var q = jQuery._data( elem, type );
1650
1651    // Speed up dequeue by getting out quickly if this is just a lookup
1652    if ( !data ) {
1653      return q || [];
1654    }
1655
1656    if ( !q || jQuery.isArray(data) ) {
1657      q = jQuery._data( elem, type, jQuery.makeArray(data) );
1658
1659    } else {
1660      q.push( data );
1661    }
1662
1663    return q;
1664  },
1665
1666  dequeue: function( elem, type ) {
1667    type = type || "fx";
1668
1669    var queue = jQuery.queue( elem, type ),
1670      fn = queue.shift();
1671
1672    // If the fx queue is dequeued, always remove the progress sentinel
1673    if ( fn === "inprogress" ) {
1674      fn = queue.shift();
1675    }
1676
1677    if ( fn ) {
1678      // Add a progress sentinel to prevent the fx queue from being
1679      // automatically dequeued
1680      if ( type === "fx" ) {
1681        queue.unshift("inprogress");
1682      }
1683
1684      fn.call(elem, function() {
1685        jQuery.dequeue(elem, type);
1686      });
1687    }
1688
1689    if ( !queue.length ) {
1690      jQuery.removeData( elem, type + "queue", true );
1691    }
1692  }
1693});
1694
1695jQuery.fn.extend({
1696  queue: function( type, data ) {
1697    if ( typeof type !== "string" ) {
1698      data = type;
1699      type = "fx";
1700    }
1701
1702    if ( data === undefined ) {
1703      return jQuery.queue( this[0], type );
1704    }
1705    return this.each(function( i ) {
1706      var queue = jQuery.queue( this, type, data );
1707
1708      if ( type === "fx" && queue[0] !== "inprogress" ) {
1709        jQuery.dequeue( this, type );
1710      }
1711    });
1712  },
1713  dequeue: function( type ) {
1714    return this.each(function() {
1715      jQuery.dequeue( this, type );
1716    });
1717  },
1718
1719  // Based off of the plugin by Clint Helfers, with permission.
1720  // http://blindsignals.com/index.php/2009/07/jquery-delay/
1721  delay: function( time, type ) {
1722    time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
1723    type = type || "fx";
1724
1725    return this.queue( type, function() {
1726      var elem = this;
1727      setTimeout(function() {
1728        jQuery.dequeue( elem, type );
1729      }, time );
1730    });
1731  },
1732
1733  clearQueue: function( type ) {
1734    return this.queue( type || "fx", [] );
1735  }
1736});
1737
1738
1739
1740
1741var rclass = /[\n\t\r]/g,
1742  rspaces = /\s+/,
1743  rreturn = /\r/g,
1744  rspecialurl = /^(?:href|src|style)$/,
1745  rtype = /^(?:button|input)$/i,
1746  rfocusable = /^(?:button|input|object|select|textarea)$/i,
1747  rclickable = /^a(?:rea)?$/i,
1748  rradiocheck = /^(?:radio|checkbox)$/i;
1749
1750jQuery.props = {
1751  "for": "htmlFor",
1752  "class": "className",
1753  readonly: "readOnly",
1754  maxlength: "maxLength",
1755  cellspacing: "cellSpacing",
1756  rowspan: "rowSpan",
1757  colspan: "colSpan",
1758  tabindex: "tabIndex",
1759  usemap: "useMap",
1760  frameborder: "frameBorder"
1761};
1762
1763jQuery.fn.extend({
1764  attr: function( name, value ) {
1765    return jQuery.access( this, name, value, true, jQuery.attr );
1766  },
1767
1768  removeAttr: function( name, fn ) {
1769    return this.each(function(){
1770      jQuery.attr( this, name, "" );
1771      if ( this.nodeType === 1 ) {
1772        this.removeAttribute( name );
1773      }
1774    });
1775  },
1776
1777  addClass: function( value ) {
1778    if ( jQuery.isFunction(value) ) {
1779      return this.each(function(i) {
1780        var self = jQuery(this);
1781        self.addClass( value.call(this, i, self.attr("class")) );
1782      });
1783    }
1784
1785    if ( value && typeof value === "string" ) {
1786      var classNames = (value || "").split( rspaces );
1787
1788      for ( var i = 0, l = this.length; i < l; i++ ) {
1789        var elem = this[i];
1790
1791        if ( elem.nodeType === 1 ) {
1792          if ( !elem.className ) {
1793            elem.className = value;
1794
1795          } else {
1796            var className = " " + elem.className + " ",
1797              setClass = elem.className;
1798
1799            for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1800              if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
1801                setClass += " " + classNames[c];
1802              }
1803            }
1804            elem.className = jQuery.trim( setClass );
1805          }
1806        }
1807      }
1808    }
1809
1810    return this;
1811  },
1812
1813  removeClass: function( value ) {
1814    if ( jQuery.isFunction(value) ) {
1815      return this.each(function(i) {
1816        var self = jQuery(this);
1817        self.removeClass( value.call(this, i, self.attr("class")) );
1818      });
1819    }
1820
1821    if ( (value && typeof value === "string") || value === undefined ) {
1822      var classNames = (value || "").split( rspaces );
1823
1824      for ( var i = 0, l = this.length; i < l; i++ ) {
1825        var elem = this[i];
1826
1827        if ( elem.nodeType === 1 && elem.className ) {
1828          if ( value ) {
1829            var className = (" " + elem.className + " ").replace(rclass, " ");
1830            for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1831              className = className.replace(" " + classNames[c] + " ", " ");
1832            }
1833            elem.className = jQuery.trim( className );
1834
1835          } else {
1836            elem.className = "";
1837          }
1838        }
1839      }
1840    }
1841
1842    return this;
1843  },
1844
1845  toggleClass: function( value, stateVal ) {
1846    var type = typeof value,
1847      isBool = typeof stateVal === "boolean";
1848
1849    if ( jQuery.isFunction( value ) ) {
1850      return this.each(function(i) {
1851        var self = jQuery(this);
1852        self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
1853      });
1854    }
1855
1856    return this.each(function() {
1857      if ( type === "string" ) {
1858        // toggle individual class names
1859        var className,
1860          i = 0,
1861          self = jQuery( this ),
1862          state = stateVal,
1863          classNames = value.split( rspaces );
1864
1865        while ( (className = classNames[ i++ ]) ) {
1866          // check each className given, space seperated list
1867          state = isBool ? state : !self.hasClass( className );
1868          self[ state ? "addClass" : "removeClass" ]( className );
1869        }
1870
1871      } else if ( type === "undefined" || type === "boolean" ) {
1872        if ( this.className ) {
1873          // store className if set
1874          jQuery._data( this, "__className__", this.className );
1875        }
1876
1877        // toggle whole className
1878        this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
1879      }
1880    });
1881  },
1882
1883  hasClass: function( selector ) {
1884    var className = " " + selector + " ";
1885    for ( var i = 0, l = this.length; i < l; i++ ) {
1886      if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
1887        return true;
1888      }
1889    }
1890
1891    return false;
1892  },
1893
1894  val: function( value ) {
1895    if ( !arguments.length ) {
1896      var elem = this[0];
1897
1898      if ( elem ) {
1899        if ( jQuery.nodeName( elem, "option" ) ) {
1900          // attributes.value is undefined in Blackberry 4.7 but
1901          // uses .value. See #6932
1902          var val = elem.attributes.value;
1903          return !val || val.specified ? elem.value : elem.text;
1904        }
1905
1906        // We need to handle select boxes special
1907        if ( jQuery.nodeName( elem, "select" ) ) {
1908          var index = elem.selectedIndex,
1909            values = [],
1910            options = elem.options,
1911            one = elem.type === "select-one";
1912
1913          // Nothing was selected
1914          if ( index < 0 ) {
1915            return null;
1916          }
1917
1918          // Loop through all the selected options
1919          for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
1920            var option = options[ i ];
1921
1922            // Don't return options that are disabled or in a disabled optgroup
1923            if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
1924                (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
1925
1926              // Get the specific value for the option
1927              value = jQuery(option).val();
1928
1929              // We don't need an array for one selects
1930              if ( one ) {
1931                return value;
1932              }
1933
1934              // Multi-Selects return an array
1935              values.push( value );
1936            }
1937          }
1938
1939          // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
1940          if ( one && !values.length && options.length ) {
1941            return jQuery( options[ index ] ).val();
1942          }
1943
1944          return values;
1945        }
1946
1947        // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
1948        if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
1949          return elem.getAttribute("value") === null ? "on" : elem.value;
1950        }
1951
1952        // Everything else, we just grab the value
1953        return (elem.value || "").replace(rreturn, "");
1954
1955      }
1956
1957      return undefined;
1958    }
1959
1960    var isFunction = jQuery.isFunction(value);
1961
1962    return this.each(function(i) {
1963      var self = jQuery(this), val = value;
1964
1965      if ( this.nodeType !== 1 ) {
1966        return;
1967      }
1968
1969      if ( isFunction ) {
1970        val = value.call(this, i, self.val());
1971      }
1972
1973      // Treat null/undefined as ""; convert numbers to string
1974      if ( val == null ) {
1975        val = "";
1976      } else if ( typeof val === "number" ) {
1977        val += "";
1978      } else if ( jQuery.isArray(val) ) {
1979        val = jQuery.map(val, function (value) {
1980          return value == null ? "" : value + "";
1981        });
1982      }
1983
1984      if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
1985        this.checked = jQuery.inArray( self.val(), val ) >= 0;
1986
1987      } else if ( jQuery.nodeName( this, "select" ) ) {
1988        var values = jQuery.makeArray(val);
1989
1990        jQuery( "option", this ).each(function() {
1991          this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
1992        });
1993
1994        if ( !values.length ) {
1995          this.selectedIndex = -1;
1996        }
1997
1998      } else {
1999        this.value = val;
2000      }
2001    });
2002  }
2003});
2004
2005jQuery.extend({
2006  attrFn: {
2007    val: true,
2008    css: true,
2009    html: true,
2010    text: true,
2011    data: true,
2012    width: true,
2013    height: true,
2014    offset: true
2015  },
2016
2017  attr: function( elem, name, value, pass ) {
2018    // don't get/set attributes on text, comment and attribute nodes
2019    if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) {
2020      return undefined;
2021    }
2022
2023    if ( pass && name in jQuery.attrFn ) {
2024      return jQuery(elem)[name](value);
2025    }
2026
2027    var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
2028      // Whether we are setting (or getting)
2029      set = value !== undefined;
2030
2031    // Try to normalize/fix the name
2032    name = notxml && jQuery.props[ name ] || name;
2033
2034    // Only do all the following if this is a node (faster for style)
2035    if ( elem.nodeType === 1 ) {
2036      // These attributes require special treatment
2037      var special = rspecialurl.test( name );
2038
2039      // Safari mis-reports the default selected property of an option
2040      // Accessing the parent's selectedIndex property fixes it
2041      if ( name === "selected" && !jQuery.support.optSelected ) {
2042        var parent = elem.parentNode;
2043        if ( parent ) {
2044          parent.selectedIndex;
2045
2046          // Make sure that it also works with optgroups, see #5701
2047          if ( parent.parentNode ) {
2048            parent.parentNode.selectedIndex;
2049          }
2050        }
2051      }
2052
2053      // If applicable, access the attribute via the DOM 0 way
2054      // 'in' checks fail in Blackberry 4.7 #6931
2055      if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
2056        if ( set ) {
2057          // We can't allow the type property to be changed (since it causes problems in IE)
2058          if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
2059            jQuery.error( "type property can't be changed" );
2060          }
2061
2062          if ( value === null ) {
2063            if ( elem.nodeType === 1 ) {
2064              elem.removeAttribute( name );
2065            }
2066
2067          } else {
2068            elem[ name ] = value;
2069          }
2070        }
2071
2072        // browsers index elements by id/name on forms, give priority to attributes.
2073        if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
2074          return elem.getAttributeNode( name ).nodeValue;
2075        }
2076
2077        // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
2078        // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
2079        if ( name === "tabIndex" ) {
2080          var attributeNode = elem.getAttributeNode( "tabIndex" );
2081
2082          return attributeNode && attributeNode.specified ?
2083            attributeNode.value :
2084            rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
2085              0 :
2086              undefined;
2087        }
2088
2089        return elem[ name ];
2090      }
2091
2092      if ( !jQuery.support.style && notxml && name === "style" ) {
2093        if ( set ) {
2094          elem.style.cssText = "" + value;
2095        }
2096
2097        return elem.style.cssText;
2098      }
2099
2100      if ( set ) {
2101        // convert the value to a string (all browsers do this but IE) see #1070
2102        elem.setAttribute( name, "" + value );
2103      }
2104
2105      // Ensure that missing attributes return undefined
2106      // Blackberry 4.7 returns "" from getAttribute #6938
2107      if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
2108        return undefined;
2109      }
2110
2111      var attr = !jQuery.support.hrefNormalized && notxml && special ?
2112          // Some attributes require a special call on IE
2113          elem.getAttribute( name, 2 ) :
2114          elem.getAttribute( name );
2115
2116      // Non-existent attributes return null, we normalize to undefined
2117      return attr === null ? undefined : attr;
2118    }
2119    // Handle everything which isn't a DOM element node
2120    if ( set ) {
2121      elem[ name ] = value;
2122    }
2123    return elem[ name ];
2124  }
2125});
2126
2127
2128
2129
2130var rnamespaces = /\.(.*)$/,
2131  rformElems = /^(?:textarea|input|select)$/i,
2132  rperiod = /\./g,
2133  rspace = / /g,
2134  rescape = /[^\w\s.|`]/g,
2135  fcleanup = function( nm ) {
2136    return nm.replace(rescape, "\\$&");
2137  };
2138
2139/*
2140 * A number of helper functions used for managing events.
2141 * Many of the ideas behind this code originated from
2142 * Dean Edwards' addEvent library.
2143 */
2144jQuery.event = {
2145
2146  // Bind an event to an element
2147  // Original by Dean Edwards
2148  add: function( elem, types, handler, data ) {
2149    if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2150      return;
2151    }
2152
2153    // TODO :: Use a try/catch until it's safe to pull this out (likely 1.6)
2154    // Minor release fix for bug #8018
2155    try {
2156      // For whatever reason, IE has trouble passing the window object
2157      // around, causing it to be cloned in the process
2158      if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
2159        elem = window;
2160      }
2161    }
2162    catch ( e ) {}
2163
2164    if ( handler === false ) {
2165      handler = returnFalse;
2166    } else if ( !handler ) {
2167      // Fixes bug #7229. Fix recommended by jdalton
2168      return;
2169    }
2170
2171    var handleObjIn, handleObj;
2172
2173    if ( handler.handler ) {
2174      handleObjIn = handler;
2175      handler = handleObjIn.handler;
2176    }
2177
2178    // Make sure that the function being executed has a unique ID
2179    if ( !handler.guid ) {
2180      handler.guid = jQuery.guid++;
2181    }
2182
2183    // Init the element's event structure
2184    var elemData = jQuery._data( elem );
2185
2186    // If no elemData is found then we must be trying to bind to one of the
2187    // banned noData elements
2188    if ( !elemData ) {
2189      return;
2190    }
2191
2192    var events = elemData.events,
2193      eventHandle = elemData.handle;
2194
2195    if ( !events ) {
2196      elemData.events = events = {};
2197    }
2198
2199    if ( !eventHandle ) {
2200      elemData.handle = eventHandle = function() {
2201        // Handle the second event of a trigger and when
2202        // an event is called after a page has unloaded
2203        return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
2204          jQuery.event.handle.apply( eventHandle.elem, arguments ) :
2205          undefined;
2206      };
2207    }
2208
2209    // Add elem as a property of the handle function
2210    // This is to prevent a memory leak with non-native events in IE.
2211    eventHandle.elem = elem;
2212
2213    // Handle multiple events separated by a space
2214    // jQuery(...).bind("mouseover mouseout", fn);
2215    types = types.split(" ");
2216
2217    var type, i = 0, namespaces;
2218
2219    while ( (type = types[ i++ ]) ) {
2220      handleObj = handleObjIn ?
2221        jQuery.extend({}, handleObjIn) :
2222        { handler: handler, data: data };
2223
2224      // Namespaced event handlers
2225      if ( type.indexOf(".") > -1 ) {
2226        namespaces = type.split(".");
2227        type = namespaces.shift();
2228        handleObj.namespace = namespaces.slice(0).sort().join(".");
2229
2230      } else {
2231        namespaces = [];
2232        handleObj.namespace = "";
2233      }
2234
2235      handleObj.type = type;
2236      if ( !handleObj.guid ) {
2237        handleObj.guid = handler.guid;
2238      }
2239
2240      // Get the current list of functions bound to this event
2241      var handlers = events[ type ],
2242        special = jQuery.event.special[ type ] || {};
2243
2244      // Init the event handler queue
2245      if ( !handlers ) {
2246        handlers = events[ type ] = [];
2247
2248        // Check for a special event handler
2249        // Only use addEventListener/attachEvent if the special
2250        // events handler returns false
2251        if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
2252          // Bind the global event handler to the element
2253          if ( elem.addEventListener ) {
2254            elem.addEventListener( type, eventHandle, false );
2255
2256          } else if ( elem.attachEvent ) {
2257            elem.attachEvent( "on" + type, eventHandle );
2258          }
2259        }
2260      }
2261
2262      if ( special.add ) {
2263        special.add.call( elem, handleObj );
2264
2265        if ( !handleObj.handler.guid ) {
2266          handleObj.handler.guid = handler.guid;
2267        }
2268      }
2269
2270      // Add the function to the element's handler list
2271      handlers.push( handleObj );
2272
2273      // Keep track of which events have been used, for global triggering
2274      jQuery.event.global[ type ] = true;
2275    }
2276
2277    // Nullify elem to prevent memory leaks in IE
2278    elem = null;
2279  },
2280
2281  global: {},
2282
2283  // Detach an event or set of events from an element
2284  remove: function( elem, types, handler, pos ) {
2285    // don't do events on text and comment nodes
2286    if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2287      return;
2288    }
2289
2290    if ( handler === false ) {
2291      handler = returnFalse;
2292    }
2293
2294    var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
2295      elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
2296      events = elemData && elemData.events;
2297
2298    if ( !elemData || !events ) {
2299      return;
2300    }
2301
2302    // types is actually an event object here
2303    if ( types && types.type ) {
2304      handler = types.handler;
2305      types = types.type;
2306    }
2307
2308    // Unbind all events for the element
2309    if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
2310      types = types || "";
2311
2312      for ( type in events ) {
2313        jQuery.event.remove( elem, type + types );
2314      }
2315
2316      return;
2317    }
2318
2319    // Handle multiple events separated by a space
2320    // jQuery(...).unbind("mouseover mouseout", fn);
2321    types = types.split(" ");
2322
2323    while ( (type = types[ i++ ]) ) {
2324      origType = type;
2325      handleObj = null;
2326      all = type.indexOf(".") < 0;
2327      namespaces = [];
2328
2329      if ( !all ) {
2330        // Namespaced event handlers
2331        namespaces = type.split(".");
2332        type = namespaces.shift();
2333
2334        namespace = new RegExp("(^|\\.)" +
2335          jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
2336      }
2337
2338      eventType = events[ type ];
2339
2340      if ( !eventType ) {
2341        continue;
2342      }
2343
2344      if ( !handler ) {
2345        for ( j = 0; j < eventType.length; j++ ) {
2346          handleObj = eventType[ j ];
2347
2348          if ( all || namespace.test( handleObj.namespace ) ) {
2349            jQuery.event.remove( elem, origType, handleObj.handler, j );
2350            eventType.splice( j--, 1 );
2351          }
2352        }
2353
2354        continue;
2355      }
2356
2357      special = jQuery.event.special[ type ] || {};
2358
2359      for ( j = pos || 0; j < eventType.length; j++ ) {
2360        handleObj = eventType[ j ];
2361
2362        if ( handler.guid === handleObj.guid ) {
2363          // remove the given handler for the given type
2364          if ( all || namespace.test( handleObj.namespace ) ) {
2365            if ( pos == null ) {
2366              eventType.splice( j--, 1 );
2367            }
2368
2369            if ( special.remove ) {
2370              special.remove.call( elem, handleObj );
2371            }
2372          }
2373
2374          if ( pos != null ) {
2375            break;
2376          }
2377        }
2378      }
2379
2380      // remove generic event handler if no more handlers exist
2381      if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
2382        if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
2383          jQuery.removeEvent( elem, type, elemData.handle );
2384        }
2385
2386        ret = null;
2387        delete events[ type ];
2388      }
2389    }
2390
2391    // Remove the expando if it's no longer used
2392    if ( jQuery.isEmptyObject( events ) ) {
2393      var handle = elemData.handle;
2394      if ( handle ) {
2395        handle.elem = null;
2396      }
2397
2398      delete elemData.events;
2399      delete elemData.handle;
2400
2401      if ( jQuery.isEmptyObject( elemData ) ) {
2402        jQuery.removeData( elem, undefined, true );
2403      }
2404    }
2405  },
2406
2407  // bubbling is internal
2408  trigger: function( event, data, elem /*, bubbling */ ) {
2409    // Event object or event type
2410    var type = event.type || event,
2411      bubbling = arguments[3];
2412
2413    if ( !bubbling ) {
2414      event = typeof event === "object" ?
2415        // jQuery.Event object
2416        event[ jQuery.expando ] ? event :
2417        // Object literal
2418        jQuery.extend( jQuery.Event(type), event ) :
2419        // Just the event type (string)
2420        jQuery.Event(type);
2421
2422      if ( type.indexOf("!") >= 0 ) {
2423        event.type = type = type.slice(0, -1);
2424        event.exclusive = true;
2425      }
2426
2427      // Handle a global trigger
2428      if ( !elem ) {
2429        // Don't bubble custom events when global (to avoid too much overhead)
2430        event.stopPropagation();
2431
2432        // Only trigger if we've ever bound an event for it
2433        if ( jQuery.event.global[ type ] ) {
2434          // XXX This code smells terrible. event.js should not be directly
2435          // inspecting the data cache
2436          jQuery.each( jQuery.cache, function() {
2437            // internalKey variable is just used to make it easier to find
2438            // and potentially change this stuff later; currently it just
2439            // points to jQuery.expando
2440            var internalKey = jQuery.expando,
2441              internalCache = this[ internalKey ];
2442            if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
2443              jQuery.event.trigger( event, data, internalCache.handle.elem );
2444            }
2445          });
2446        }
2447      }
2448
2449      // Handle triggering a single element
2450
2451      // don't do events on text and comment nodes
2452      if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
2453        return undefined;
2454      }
2455
2456      // Clean up in case it is reused
2457      event.result = undefined;
2458      event.target = elem;
2459
2460      // Clone the incoming data, if any
2461      data = jQuery.makeArray( data );
2462      data.unshift( event );
2463    }
2464
2465    event.currentTarget = elem;
2466
2467    // Trigger the event, it is assumed that "handle" is a function
2468    var handle = jQuery._data( elem, "handle" );
2469
2470    if ( handle ) {
2471      handle.apply( elem, data );
2472    }
2473
2474    var parent = elem.parentNode || elem.ownerDocument;
2475
2476    // Trigger an inline bound script
2477    try {
2478      if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
2479        if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
2480          event.result = false;
2481          event.preventDefault();
2482        }
2483      }
2484
2485    // prevent IE from throwing an error for some elements with some event types, see #3533
2486    } catch (inlineError) {}
2487
2488    if ( !event.isPropagationStopped() && parent ) {
2489      jQuery.event.trigger( event, data, parent, true );
2490
2491    } else if ( !event.isDefaultPrevented() ) {
2492      var old,
2493        target = event.target,
2494        targetType = type.replace( rnamespaces, "" ),
2495        isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
2496        special = jQuery.event.special[ targetType ] || {};
2497
2498      if ( (!special._default || special._default.call( elem, event ) === false) &&
2499        !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
2500
2501        try {
2502          if ( target[ targetType ] ) {
2503            // Make sure that we don't accidentally re-trigger the onFOO events
2504            old = target[ "on" + targetType ];
2505
2506            if ( old ) {
2507              target[ "on" + targetType ] = null;
2508            }
2509
2510            jQuery.event.triggered = true;
2511            target[ targetType ]();
2512          }
2513
2514        // prevent IE from throwing an error for some elements with some event types, see #3533
2515        } catch (triggerError) {}
2516
2517        if ( old ) {
2518          target[ "on" + targetType ] = old;
2519        }
2520
2521        jQuery.event.triggered = false;
2522      }
2523    }
2524  },
2525
2526  handle: function( event ) {
2527    var all, handlers, namespaces, namespace_re, events,
2528      namespace_sort = [],
2529      args = jQuery.makeArray( arguments );
2530
2531    event = args[0] = jQuery.event.fix( event || window.event );
2532    event.currentTarget = this;
2533
2534    // Namespaced event handlers
2535    all = event.type.indexOf(".") < 0 && !event.exclusive;
2536
2537    if ( !all ) {
2538      namespaces = event.type.split(".");
2539      event.type = namespaces.shift();
2540      namespace_sort = namespaces.slice(0).sort();
2541      namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
2542    }
2543
2544    event.namespace = event.namespace || namespace_sort.join(".");
2545
2546    events = jQuery._data(this, "events");
2547
2548    handlers = (events || {})[ event.type ];
2549
2550    if ( events && handlers ) {
2551      // Clone the handlers to prevent manipulation
2552      handlers = handlers.slice(0);
2553
2554      for ( var j = 0, l = handlers.length; j < l; j++ ) {
2555        var handleObj = handlers[ j ];
2556
2557        // Filter the functions by class
2558        if ( all || namespace_re.test( handleObj.namespace ) ) {
2559          // Pass in a reference to the handler function itself
2560          // So that we can later remove it
2561          event.handler = handleObj.handler;
2562          event.data = handleObj.data;
2563          event.handleObj = handleObj;
2564
2565          var ret = handleObj.handler.apply( this, args );
2566
2567          if ( ret !== undefined ) {
2568            event.result = ret;
2569            if ( ret === false ) {
2570              event.preventDefault();
2571              event.stopPropagation();
2572            }
2573          }
2574
2575          if ( event.isImmediatePropagationStopped() ) {
2576            break;
2577          }
2578        }
2579      }
2580    }
2581
2582    return event.result;
2583  },
2584
2585  props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
2586
2587  fix: function( event ) {
2588    if ( event[ jQuery.expando ] ) {
2589      return event;
2590    }
2591
2592    // store a copy of the original event object
2593    // and "clone" to set read-only properties
2594    var originalEvent = event;
2595    event = jQuery.Event( originalEvent );
2596
2597    for ( var i = this.props.length, prop; i; ) {
2598      prop = this.props[ --i ];
2599      event[ prop ] = originalEvent[ prop ];
2600    }
2601
2602    // Fix target property, if necessary
2603    if ( !event.target ) {
2604      // Fixes #1925 where srcElement might not be defined either
2605      event.target = event.srcElement || document;
2606    }
2607
2608    // check if target is a textnode (safari)
2609    if ( event.target.nodeType === 3 ) {
2610      event.target = event.target.parentNode;
2611    }
2612
2613    // Add relatedTarget, if necessary
2614    if ( !event.relatedTarget && event.fromElement ) {
2615      event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
2616    }
2617
2618    // Calculate pageX/Y if missing and clientX/Y available
2619    if ( event.pageX == null && event.clientX != null ) {
2620      var doc = document.documentElement,
2621        body = document.body;
2622
2623      event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
2624      event.pageY = event.clientY + (doc && doc.scrollTop  || body && body.scrollTop  || 0) - (doc && doc.clientTop  || body && body.clientTop  || 0);
2625    }
2626
2627    // Add which for key events
2628    if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
2629      event.which = event.charCode != null ? event.charCode : event.keyCode;
2630    }
2631
2632    // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
2633    if ( !event.metaKey && event.ctrlKey ) {
2634      event.metaKey = event.ctrlKey;
2635    }
2636
2637    // Add which for click: 1 === left; 2 === middle; 3 === right
2638    // Note: button is not normalized, so don't use it
2639    if ( !event.which && event.button !== undefined ) {
2640      event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
2641    }
2642
2643    return event;
2644  },
2645
2646  // Deprecated, use jQuery.guid instead
2647  guid: 1E8,
2648
2649  // Deprecated, use jQuery.proxy instead
2650  proxy: jQuery.proxy,
2651
2652  special: {
2653    ready: {
2654      // Make sure the ready event is setup
2655      setup: jQuery.bindReady,
2656      teardown: jQuery.noop
2657    },
2658
2659    live: {
2660      add: function( handleObj ) {
2661        jQuery.event.add( this,
2662          liveConvert( handleObj.origType, handleObj.selector ),
2663          jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
2664      },
2665
2666      remove: function( handleObj ) {
2667        jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
2668      }
2669    },
2670
2671    beforeunload: {
2672      setup: function( data, namespaces, eventHandle ) {
2673        // We only want to do this special case on windows
2674        if ( jQuery.isWindow( this ) ) {
2675          this.onbeforeunload = eventHandle;
2676        }
2677      },
2678
2679      teardown: function( namespaces, eventHandle ) {
2680        if ( this.onbeforeunload === eventHandle ) {
2681          this.onbeforeunload = null;
2682        }
2683      }
2684    }
2685  }
2686};
2687
2688jQuery.removeEvent = document.removeEventListener ?
2689  function( elem, type, handle ) {
2690    if ( elem.removeEventListener ) {
2691      elem.removeEventListener( type, handle, false );
2692    }
2693  } :
2694  function( elem, type, handle ) {
2695    if ( elem.detachEvent ) {
2696      elem.detachEvent( "on" + type, handle );
2697    }
2698  };
2699
2700jQuery.Event = function( src ) {
2701  // Allow instantiation without the 'new' keyword
2702  if ( !this.preventDefault ) {
2703    return new jQuery.Event( src );
2704  }
2705
2706  // Event object
2707  if ( src && src.type ) {
2708    this.originalEvent = src;
2709    this.type = src.type;
2710
2711    // Events bubbling up the document may have been marked as prevented
2712    // by a handler lower down the tree; reflect the correct value.
2713    this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
2714      src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
2715
2716  // Event type
2717  } else {
2718    this.type = src;
2719  }
2720
2721  // timeStamp is buggy for some events on Firefox(#3843)
2722  // So we won't rely on the native value
2723  this.timeStamp = jQuery.now();
2724
2725  // Mark it as fixed
2726  this[ jQuery.expando ] = true;
2727};
2728
2729function returnFalse() {
2730  return false;
2731}
2732function returnTrue() {
2733  return true;
2734}
2735
2736// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
2737// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
2738jQuery.Event.prototype = {
2739  preventDefault: function() {
2740    this.isDefaultPrevented = returnTrue;
2741
2742    var e = this.originalEvent;
2743    if ( !e ) {
2744      return;
2745    }
2746
2747    // if preventDefault exists run it on the original event
2748    if ( e.preventDefault ) {
2749      e.preventDefault();
2750
2751    // otherwise set the returnValue property of the original event to false (IE)
2752    } else {
2753      e.returnValue = false;
2754    }
2755  },
2756  stopPropagation: function() {
2757    this.isPropagationStopped = returnTrue;
2758
2759    var e = this.originalEvent;
2760    if ( !e ) {
2761      return;
2762    }
2763    // if stopPropagation exists run it on the original event
2764    if ( e.stopPropagation ) {
2765      e.stopPropagation();
2766    }
2767    // otherwise set the cancelBubble property of the original event to true (IE)
2768    e.cancelBubble = true;
2769  },
2770  stopImmediatePropagation: function() {
2771    this.isImmediatePropagationStopped = returnTrue;
2772    this.stopPropagation();
2773  },
2774  isDefaultPrevented: returnFalse,
2775  isPropagationStopped: returnFalse,
2776  isImmediatePropagationStopped: returnFalse
2777};
2778
2779// Checks if an event happened on an element within another element
2780// Used in jQuery.event.special.mouseenter and mouseleave handlers
2781var withinElement = function( event ) {
2782  // Check if mouse(over|out) are still within the same parent element
2783  var parent = event.relatedTarget;
2784
2785  // Firefox sometimes assigns relatedTarget a XUL element
2786  // which we cannot access the parentNode property of
2787  try {
2788
2789    // Chrome does something similar, the parentNode property
2790    // can be accessed but is null.
2791    if ( parent !== document && !parent.parentNode ) {
2792      return;
2793    }
2794    // Traverse up the tree
2795    while ( parent && parent !== this ) {
2796      parent = parent.parentNode;
2797    }
2798
2799    if ( parent !== this ) {
2800      // set the correct event type
2801      event.type = event.data;
2802
2803      // handle event if we actually just moused on to a non sub-element
2804      jQuery.event.handle.apply( this, arguments );
2805    }
2806
2807  // assuming we've left the element since we most likely mousedover a xul element
2808  } catch(e) { }
2809},
2810
2811// In case of event delegation, we only need to rename the event.type,
2812// liveHandler will take care of the rest.
2813delegate = function( event ) {
2814  event.type = event.data;
2815  jQuery.event.handle.apply( this, arguments );
2816};
2817
2818// Create mouseenter and mouseleave events
2819jQuery.each({
2820  mouseenter: "mouseover",
2821  mouseleave: "mouseout"
2822}, function( orig, fix ) {
2823  jQuery.event.special[ orig ] = {
2824    setup: function( data ) {
2825      jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
2826    },
2827    teardown: function( data ) {
2828      jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
2829    }
2830  };
2831});
2832
2833// submit delegation
2834if ( !jQuery.support.submitBubbles ) {
2835
2836  jQuery.event.special.submit = {
2837    setup: function( data, namespaces ) {
2838      if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) {
2839        jQuery.event.add(this, "click.specialSubmit", function( e ) {
2840          var elem = e.target,
2841            type = elem.type;
2842
2843          if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
2844            trigger( "submit", this, arguments );
2845          }
2846        });
2847
2848        jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
2849          var elem = e.target,
2850            type = elem.type;
2851
2852          if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
2853            trigger( "submit", this, arguments );
2854          }
2855        });
2856
2857      } else {
2858        return false;
2859      }
2860    },
2861
2862    teardown: function( namespaces ) {
2863      jQuery.event.remove( this, ".specialSubmit" );
2864    }
2865  };
2866
2867}
2868
2869// change delegation, happens here so we have bind.
2870if ( !jQuery.support.changeBubbles ) {
2871
2872  var changeFilters,
2873
2874  getVal = function( elem ) {
2875    var type = elem.type, val = elem.value;
2876
2877    if ( type === "radio" || type === "checkbox" ) {
2878      val = elem.checked;
2879
2880    } else if ( type === "select-multiple" ) {
2881      val = elem.selectedIndex > -1 ?
2882        jQuery.map( elem.options, function( elem ) {
2883          return elem.selected;
2884        }).join("-") :
2885        "";
2886
2887    } else if ( elem.nodeName.toLowerCase() === "select" ) {
2888      val = elem.selectedIndex;
2889    }
2890
2891    return val;
2892  },
2893
2894  testChange = function testChange( e ) {
2895    var elem = e.target, data, val;
2896
2897    if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
2898      return;
2899    }
2900
2901    data = jQuery._data( elem, "_change_data" );
2902    val = getVal(elem);
2903
2904    // the current data will be also retrieved by beforeactivate
2905    if ( e.type !== "focusout" || elem.type !== "radio" ) {
2906      jQuery._data( elem, "_change_data", val );
2907    }
2908
2909    if ( data === undefined || val === data ) {
2910      return;
2911    }
2912
2913    if ( data != null || val ) {
2914      e.type = "change";
2915      e.liveFired = undefined;
2916      jQuery.event.trigger( e, arguments[1], elem );
2917    }
2918  };
2919
2920  jQuery.event.special.change = {
2921    filters: {
2922      focusout: testChange,
2923
2924      beforedeactivate: testChange,
2925
2926      click: function( e ) {
2927        var elem = e.target, type = elem.type;
2928
2929        if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
2930          testChange.call( this, e );
2931        }
2932      },
2933
2934      // Change has to be called before submit
2935      // Keydown will be called before keypress, which is used in submit-event delegation
2936      keydown: function( e ) {
2937        var elem = e.target, type = elem.type;
2938
2939        if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
2940          (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
2941          type === "select-multiple" ) {
2942          testChange.call( this, e );
2943        }
2944      },
2945
2946      // Beforeactivate happens also before the previous element is blurred
2947      // with this event you can't trigger a change event, but you can store
2948      // information
2949      beforeactivate: function( e ) {
2950        var elem = e.target;
2951        jQuery._data( elem, "_change_data", getVal(elem) );
2952      }
2953    },
2954
2955    setup: function( data, namespaces ) {
2956      if ( this.type === "file" ) {
2957        return false;
2958      }
2959
2960      for ( var type in changeFilters ) {
2961        jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
2962      }
2963
2964      return rformElems.test( this.nodeName );
2965    },
2966
2967    teardown: function( namespaces ) {
2968      jQuery.event.remove( this, ".specialChange" );
2969
2970      return rformElems.test( this.nodeName );
2971    }
2972  };
2973
2974  changeFilters = jQuery.event.special.change.filters;
2975
2976  // Handle when the input is .focus()'d
2977  changeFilters.focus = changeFilters.beforeactivate;
2978}
2979
2980function trigger( type, elem, args ) {
2981  // Piggyback on a donor event to simulate a different one.
2982  // Fake originalEvent to avoid donor's stopPropagation, but if the
2983  // simulated event prevents default then we do the same on the donor.
2984  // Don't pass args or remember liveFired; they apply to the donor event.
2985  var event = jQuery.extend( {}, args[ 0 ] );
2986  event.type = type;
2987  event.originalEvent = {};
2988  event.liveFired = undefined;
2989  jQuery.event.handle.call( elem, event );
2990  if ( event.isDefaultPrevented() ) {
2991    args[ 0 ].preventDefault();
2992  }
2993}
2994
2995// Create "bubbling" focus and blur events
2996if ( document.addEventListener ) {
2997  jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
2998    jQuery.event.special[ fix ] = {
2999      setup: function() {
3000        this.addEventListener( orig, handler, true );
3001      },
3002      teardown: function() {
3003        this.removeEventListener( orig, handler, true );
3004      }
3005    };
3006
3007    function handler( e ) {
3008      e = jQuery.event.fix( e );
3009      e.type = fix;
3010      return jQuery.event.handle.call( this, e );
3011    }
3012  });
3013}
3014
3015jQuery.each(["bind", "one"], function( i, name ) {
3016  jQuery.fn[ name ] = function( type, data, fn ) {
3017    // Handle object literals
3018    if ( typeof type === "object" ) {
3019      for ( var key in type ) {
3020        this[ name ](key, data, type[key], fn);
3021      }
3022      return this;
3023    }
3024
3025    if ( jQuery.isFunction( data ) || data === false ) {
3026      fn = data;
3027      data = undefined;
3028    }
3029
3030    var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
3031      jQuery( this ).unbind( event, handler );
3032      return fn.apply( this, arguments );
3033    }) : fn;
3034
3035    if ( type === "unload" && name !== "one" ) {
3036      this.one( type, data, fn );
3037
3038    } else {
3039      for ( var i = 0, l = this.length; i < l; i++ ) {
3040        jQuery.event.add( this[i], type, handler, data );
3041      }
3042    }
3043
3044    return this;
3045  };
3046});
3047
3048jQuery.fn.extend({
3049  unbind: function( type, fn ) {
3050    // Handle object literals
3051    if ( typeof type === "object" && !type.preventDefault ) {
3052      for ( var key in type ) {
3053        this.unbind(key, type[key]);
3054      }
3055
3056    } else {
3057      for ( var i = 0, l = this.length; i < l; i++ ) {
3058        jQuery.event.remove( this[i], type, fn );
3059      }
3060    }
3061
3062    return this;
3063  },
3064
3065  delegate: function( selector, types, data, fn ) {
3066    return this.live( types, data, fn, selector );
3067  },
3068
3069  undelegate: function( selector, types, fn ) {
3070    if ( arguments.length === 0 ) {
3071        return this.unbind( "live" );
3072
3073    } else {
3074      return this.die( types, null, fn, selector );
3075    }
3076  },
3077
3078  trigger: function( type, data ) {
3079    return this.each(function() {
3080      jQuery.event.trigger( type, data, this );
3081    });
3082  },
3083
3084  triggerHandler: function( type, data ) {
3085    if ( this[0] ) {
3086      var event = jQuery.Event( type );
3087      event.preventDefault();
3088      event.stopPropagation();
3089      jQuery.event.trigger( event, data, this[0] );
3090      return event.result;
3091    }
3092  },
3093
3094  toggle: function( fn ) {
3095    // Save reference to arguments for access in closure
3096    var args = arguments,
3097      i = 1;
3098
3099    // link all the functions, so any of them can unbind this click handler
3100    while ( i < args.length ) {
3101      jQuery.proxy( fn, args[ i++ ] );
3102    }
3103
3104    return this.click( jQuery.proxy( fn, function( event ) {
3105      // Figure out which function to execute
3106      var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
3107      jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
3108
3109      // Make sure that clicks stop
3110      event.preventDefault();
3111
3112      // and execute the function
3113      return args[ lastToggle ].apply( this, arguments ) || false;
3114    }));
3115  },
3116
3117  hover: function( fnOver, fnOut ) {
3118    return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
3119  }
3120});
3121
3122var liveMap = {
3123  focus: "focusin",
3124  blur: "focusout",
3125  mouseenter: "mouseover",
3126  mouseleave: "mouseout"
3127};
3128
3129jQuery.each(["live", "die"], function( i, name ) {
3130  jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
3131    var type, i = 0, match, namespaces, preType,
3132      selector = origSelector || this.selector,
3133      context = origSelector ? this : jQuery( this.context );
3134
3135    if ( typeof types === "object" && !types.preventDefault ) {
3136      for ( var key in types ) {
3137        context[ name ]( key, data, types[key], selector );
3138      }
3139
3140      return this;
3141    }
3142
3143    if ( jQuery.isFunction( data ) ) {
3144      fn = data;
3145      data = undefined;
3146    }
3147
3148    types = (types || "").split(" ");
3149
3150    while ( (type = types[ i++ ]) != null ) {
3151      match = rnamespaces.exec( type );
3152      namespaces = "";
3153
3154      if ( match )  {
3155        namespaces = match[0];
3156        type = type.replace( rnamespaces, "" );
3157      }
3158
3159      if ( type === "hover" ) {
3160        types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
3161        continue;
3162      }
3163
3164      preType = type;
3165
3166      if ( type === "focus" || type === "blur" ) {
3167        types.push( liveMap[ type ] + namespaces );
3168        type = type + namespaces;
3169
3170      } else {
3171        type = (liveMap[ type ] || type) + namespaces;
3172      }
3173
3174      if ( name === "live" ) {
3175        // bind live handler
3176        for ( var j = 0, l = context.length; j < l; j++ ) {
3177          jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
3178            { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
3179        }
3180
3181      } else {
3182        // unbind live handler
3183        context.unbind( "live." + liveConvert( type, selector ), fn );
3184      }
3185    }
3186
3187    return this;
3188  };
3189});
3190
3191function liveHandler( event ) {
3192  var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
3193    elems = [],
3194    selectors = [],
3195    events = jQuery._data( this, "events" );
3196
3197  // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
3198  if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
3199    return;
3200  }
3201
3202  if ( event.namespace ) {
3203    namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
3204  }
3205
3206  event.liveFired = this;
3207
3208  var live = events.live.slice(0);
3209
3210  for ( j = 0; j < live.length; j++ ) {
3211    handleObj = live[j];
3212
3213    if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
3214      selectors.push( handleObj.selector );
3215
3216    } else {
3217      live.splice( j--, 1 );
3218    }
3219  }
3220
3221  match = jQuery( event.target ).closest( selectors, event.currentTarget );
3222
3223  for ( i = 0, l = match.length; i < l; i++ ) {
3224    close = match[i];
3225
3226    for ( j = 0; j < live.length; j++ ) {
3227      handleObj = live[j];
3228
3229      if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
3230        elem = close.elem;
3231        related = null;
3232
3233        // Those two events require additional checking
3234        if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
3235          event.type = handleObj.preType;
3236          related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
3237        }
3238
3239        if ( !related || related !== elem ) {
3240          elems.push({ elem: elem, handleObj: handleObj, level: close.level });
3241        }
3242      }
3243    }
3244  }
3245
3246  for ( i = 0, l = elems.length; i < l; i++ ) {
3247    match = elems[i];
3248
3249    if ( maxLevel && match.level > maxLevel ) {
3250      break;
3251    }
3252
3253    event.currentTarget = match.elem;
3254    event.data = match.handleObj.data;
3255    event.handleObj = match.handleObj;
3256
3257    ret = match.handleObj.origHandler.apply( match.elem, arguments );
3258
3259    if ( ret === false || event.isPropagationStopped() ) {
3260      maxLevel = match.level;
3261
3262      if ( ret === false ) {
3263        stop = false;
3264      }
3265      if ( event.isImmediatePropagationStopped() ) {
3266        break;
3267      }
3268    }
3269  }
3270
3271  return stop;
3272}
3273
3274function liveConvert( type, selector ) {
3275  return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
3276}
3277
3278jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
3279  "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
3280  "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
3281
3282  // Handle event binding
3283  jQuery.fn[ name ] = function( data, fn ) {
3284    if ( fn == null ) {
3285      fn = data;
3286      data = null;
3287    }
3288
3289    return arguments.length > 0 ?
3290      this.bind( name, data, fn ) :
3291      this.trigger( name );
3292  };
3293
3294  if ( jQuery.attrFn ) {
3295    jQuery.attrFn[ name ] = true;
3296  }
3297});
3298
3299
3300/*!
3301 * Note: While Microsoft is not the author of this file, Microsoft is
3302 * offering you a license subject to the terms of the Microsoft Software
3303 * License Terms for Microsoft ASP.NET Model View Controller 3.
3304 * Microsoft reserves all other rights. The notices below are provided
3305 * for informational purposes only and are not the license terms under
3306 * which Microsoft distributed this file.
3307 *
3308 * Sizzle CSS Selector Engine
3309 *  Copyright 2011, The Dojo Foundation
3310 *  More information: http://sizzlejs.com/
3311 */
3312(function(){
3313
3314var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
3315  done = 0,
3316  toString = Object.prototype.toString,
3317  hasDuplicate = false,
3318  baseHasDuplicate = true,
3319  rBackslash = /\\/g,
3320  rNonWord = /\W/;
3321
3322// Here we check if the JavaScript engine is using some sort of
3323// optimization where it does not always call our comparision
3324// function. If that is the case, discard the hasDuplicate value.
3325//   Thus far that includes Google Chrome.
3326[0, 0].sort(function() {
3327  baseHasDuplicate = false;
3328  return 0;
3329});
3330
3331var Sizzle = function( selector, context, results, seed ) {
3332  results = results || [];
3333  context = context || document;
3334
3335  var origContext = context;
3336
3337  if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
3338    return [];
3339  }
3340 
3341  if ( !selector || typeof selector !== "string" ) {
3342    return results;
3343  }
3344
3345  var m, set, checkSet, extra, ret, cur, pop, i,
3346    prune = true,
3347    contextXML = Sizzle.isXML( context ),
3348    parts = [],
3349    soFar = selector;
3350 
3351  // Reset the position of the chunker regexp (start from head)
3352  do {
3353    chunker.exec( "" );
3354    m = chunker.exec( soFar );
3355
3356    if ( m ) {
3357      soFar = m[3];
3358   
3359      parts.push( m[1] );
3360   
3361      if ( m[2] ) {
3362        extra = m[3];
3363        break;
3364      }
3365    }
3366  } while ( m );
3367
3368  if ( parts.length > 1 && origPOS.exec( selector ) ) {
3369
3370    if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
3371      set = posProcess( parts[0] + parts[1], context );
3372
3373    } else {
3374      set = Expr.relative[ parts[0] ] ?
3375        [ context ] :
3376        Sizzle( parts.shift(), context );
3377
3378      while ( parts.length ) {
3379        selector = parts.shift();
3380
3381        if ( Expr.relative[ selector ] ) {
3382          selector += parts.shift();
3383        }
3384       
3385        set = posProcess( selector, set );
3386      }
3387    }
3388
3389  } else {
3390    // Take a shortcut and set the context if the root selector is an ID
3391    // (but not if it'll be faster if the inner selector is an ID)
3392    if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
3393        Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
3394
3395      ret = Sizzle.find( parts.shift(), context, contextXML );
3396      context = ret.expr ?
3397        Sizzle.filter( ret.expr, ret.set )[0] :
3398        ret.set[0];
3399    }
3400
3401    if ( context ) {
3402      ret = seed ?
3403        { expr: parts.pop(), set: makeArray(seed) } :
3404        Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
3405
3406      set = ret.expr ?
3407        Sizzle.filter( ret.expr, ret.set ) :
3408        ret.set;
3409
3410      if ( parts.length > 0 ) {
3411        checkSet = makeArray( set );
3412
3413      } else {
3414        prune = false;
3415      }
3416
3417      while ( parts.length ) {
3418        cur = parts.pop();
3419        pop = cur;
3420
3421        if ( !Expr.relative[ cur ] ) {
3422          cur = "";
3423        } else {
3424          pop = parts.pop();
3425        }
3426
3427        if ( pop == null ) {
3428          pop = context;
3429        }
3430
3431        Expr.relative[ cur ]( checkSet, pop, contextXML );
3432      }
3433
3434    } else {
3435      checkSet = parts = [];
3436    }
3437  }
3438
3439  if ( !checkSet ) {
3440    checkSet = set;
3441  }
3442
3443  if ( !checkSet ) {
3444    Sizzle.error( cur || selector );
3445  }
3446
3447  if ( toString.call(checkSet) === "[object Array]" ) {
3448    if ( !prune ) {
3449      results.push.apply( results, checkSet );
3450
3451    } else if ( context && context.nodeType === 1 ) {
3452      for ( i = 0; checkSet[i] != null; i++ ) {
3453        if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
3454          results.push( set[i] );
3455        }
3456      }
3457
3458    } else {
3459      for ( i = 0; checkSet[i] != null; i++ ) {
3460        if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
3461          results.push( set[i] );
3462        }
3463      }
3464    }
3465
3466  } else {
3467    makeArray( checkSet, results );
3468  }
3469
3470  if ( extra ) {
3471    Sizzle( extra, origContext, results, seed );
3472    Sizzle.uniqueSort( results );
3473  }
3474
3475  return results;
3476};
3477
3478Sizzle.uniqueSort = function( results ) {
3479  if ( sortOrder ) {
3480    hasDuplicate = baseHasDuplicate;
3481    results.sort( sortOrder );
3482
3483    if ( hasDuplicate ) {
3484      for ( var i = 1; i < results.length; i++ ) {
3485        if ( results[i] === results[ i - 1 ] ) {
3486          results.splice( i--, 1 );
3487        }
3488      }
3489    }
3490  }
3491
3492  return results;
3493};
3494
3495Sizzle.matches = function( expr, set ) {
3496  return Sizzle( expr, null, null, set );
3497};
3498
3499Sizzle.matchesSelector = function( node, expr ) {
3500  return Sizzle( expr, null, null, [node] ).length > 0;
3501};
3502
3503Sizzle.find = function( expr, context, isXML ) {
3504  var set;
3505
3506  if ( !expr ) {
3507    return [];
3508  }
3509
3510  for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
3511    var match,
3512      type = Expr.order[i];
3513   
3514    if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
3515      var left = match[1];
3516      match.splice( 1, 1 );
3517
3518      if ( left.substr( left.length - 1 ) !== "\\" ) {
3519        match[1] = (match[1] || "").replace( rBackslash, "" );
3520        set = Expr.find[ type ]( match, context, isXML );
3521
3522        if ( set != null ) {
3523          expr = expr.replace( Expr.match[ type ], "" );
3524          break;
3525        }
3526      }
3527    }
3528  }
3529
3530  if ( !set ) {
3531    set = typeof context.getElementsByTagName !== "undefined" ?
3532      context.getElementsByTagName( "*" ) :
3533      [];
3534  }
3535
3536  return { set: set, expr: expr };
3537};
3538
3539Sizzle.filter = function( expr, set, inplace, not ) {
3540  var match, anyFound,
3541    old = expr,
3542    result = [],
3543    curLoop = set,
3544    isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
3545
3546  while ( expr && set.length ) {
3547    for ( var type in Expr.filter ) {
3548      if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
3549        var found, item,
3550          filter = Expr.filter[ type ],
3551          left = match[1];
3552
3553        anyFound = false;
3554
3555        match.splice(1,1);
3556
3557        if ( left.substr( left.length - 1 ) === "\\" ) {
3558          continue;
3559        }
3560
3561        if ( curLoop === result ) {
3562          result = [];
3563        }
3564
3565        if ( Expr.preFilter[ type ] ) {
3566          match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
3567
3568          if ( !match ) {
3569            anyFound = found = true;
3570
3571          } else if ( match === true ) {
3572            continue;
3573          }
3574        }
3575
3576        if ( match ) {
3577          for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
3578            if ( item ) {
3579              found = filter( item, match, i, curLoop );
3580              var pass = not ^ !!found;
3581
3582              if ( inplace && found != null ) {
3583                if ( pass ) {
3584                  anyFound = true;
3585
3586                } else {
3587                  curLoop[i] = false;
3588                }
3589
3590              } else if ( pass ) {
3591                result.push( item );
3592                anyFound = true;
3593              }
3594            }
3595          }
3596        }
3597
3598        if ( found !== undefined ) {
3599          if ( !inplace ) {
3600            curLoop = result;
3601          }
3602
3603          expr = expr.replace( Expr.match[ type ], "" );
3604
3605          if ( !anyFound ) {
3606            return [];
3607          }
3608
3609          break;
3610        }
3611      }
3612    }
3613
3614    // Improper expression
3615    if ( expr === old ) {
3616      if ( anyFound == null ) {
3617        Sizzle.error( expr );
3618
3619      } else {
3620        break;
3621      }
3622    }
3623
3624    old = expr;
3625  }
3626
3627  return curLoop;
3628};
3629
3630Sizzle.error = function( msg ) {
3631  throw "Syntax error, unrecognized expression: " + msg;
3632};
3633
3634var Expr = Sizzle.selectors = {
3635  order: [ "ID", "NAME", "TAG" ],
3636
3637  match: {
3638    ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
3639    CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
3640    NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
3641    ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
3642    TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
3643    CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
3644    POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
3645    PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
3646  },
3647
3648  leftMatch: {},
3649
3650  attrMap: {
3651    "class": "className",
3652    "for": "htmlFor"
3653  },
3654
3655  attrHandle: {
3656    href: function( elem ) {
3657      return elem.getAttribute( "href" );
3658    },
3659    type: function( elem ) {
3660      return elem.getAttribute( "type" );
3661    }
3662  },
3663
3664  relative: {
3665    "+": function(checkSet, part){
3666      var isPartStr = typeof part === "string",
3667        isTag = isPartStr && !rNonWord.test( part ),
3668        isPartStrNotTag = isPartStr && !isTag;
3669
3670      if ( isTag ) {
3671        part = part.toLowerCase();
3672      }
3673
3674      for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
3675        if ( (elem = checkSet[i]) ) {
3676          while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
3677
3678          checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
3679            elem || false :
3680            elem === part;
3681        }
3682      }
3683
3684      if ( isPartStrNotTag ) {
3685        Sizzle.filter( part, checkSet, true );
3686      }
3687    },
3688
3689    ">": function( checkSet, part ) {
3690      var elem,
3691        isPartStr = typeof part === "string",
3692        i = 0,
3693        l = checkSet.length;
3694
3695      if ( isPartStr && !rNonWord.test( part ) ) {
3696        part = part.toLowerCase();
3697
3698        for ( ; i < l; i++ ) {
3699          elem = checkSet[i];
3700
3701          if ( elem ) {
3702            var parent = elem.parentNode;
3703            checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
3704          }
3705        }
3706
3707      } else {
3708        for ( ; i < l; i++ ) {
3709          elem = checkSet[i];
3710
3711          if ( elem ) {
3712            checkSet[i] = isPartStr ?
3713              elem.parentNode :
3714              elem.parentNode === part;
3715          }
3716        }
3717
3718        if ( isPartStr ) {
3719          Sizzle.filter( part, checkSet, true );
3720        }
3721      }
3722    },
3723
3724    "": function(checkSet, part, isXML){
3725      var nodeCheck,
3726        doneName = done++,
3727        checkFn = dirCheck;
3728
3729      if ( typeof part === "string" && !rNonWord.test( part ) ) {
3730        part = part.toLowerCase();
3731        nodeCheck = part;
3732        checkFn = dirNodeCheck;
3733      }
3734
3735      checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
3736    },
3737
3738    "~": function( checkSet, part, isXML ) {
3739      var nodeCheck,
3740        doneName = done++,
3741        checkFn = dirCheck;
3742
3743      if ( typeof part === "string" && !rNonWord.test( part ) ) {
3744        part = part.toLowerCase();
3745        nodeCheck = part;
3746        checkFn = dirNodeCheck;
3747      }
3748
3749      checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
3750    }
3751  },
3752
3753  find: {
3754    ID: function( match, context, isXML ) {
3755      if ( typeof context.getElementById !== "undefined" && !isXML ) {
3756        var m = context.getElementById(match[1]);
3757        // Check parentNode to catch when Blackberry 4.6 returns
3758        // nodes that are no longer in the document #6963
3759        return m && m.parentNode ? [m] : [];
3760      }
3761    },
3762
3763    NAME: function( match, context ) {
3764      if ( typeof context.getElementsByName !== "undefined" ) {
3765        var ret = [],
3766          results = context.getElementsByName( match[1] );
3767
3768        for ( var i = 0, l = results.length; i < l; i++ ) {
3769          if ( results[i].getAttribute("name") === match[1] ) {
3770            ret.push( results[i] );
3771          }
3772        }
3773
3774        return ret.length === 0 ? null : ret;
3775      }
3776    },
3777
3778    TAG: function( match, context ) {
3779      if ( typeof context.getElementsByTagName !== "undefined" ) {
3780        return context.getElementsByTagName( match[1] );
3781      }
3782    }
3783  },
3784  preFilter: {
3785    CLASS: function( match, curLoop, inplace, result, not, isXML ) {
3786      match = " " + match[1].replace( rBackslash, "" ) + " ";
3787
3788      if ( isXML ) {
3789        return match;
3790      }
3791
3792      for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
3793        if ( elem ) {
3794          if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
3795            if ( !inplace ) {
3796              result.push( elem );
3797            }
3798
3799          } else if ( inplace ) {
3800            curLoop[i] = false;
3801          }
3802        }
3803      }
3804
3805      return false;
3806    },
3807
3808    ID: function( match ) {
3809      return match[1].replace( rBackslash, "" );
3810    },
3811
3812    TAG: function( match, curLoop ) {
3813      return match[1].replace( rBackslash, "" ).toLowerCase();
3814    },
3815
3816    CHILD: function( match ) {
3817      if ( match[1] === "nth" ) {
3818        if ( !match[2] ) {
3819          Sizzle.error( match[0] );
3820        }
3821
3822        match[2] = match[2].replace(/^\+|\s*/g, '');
3823
3824        // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
3825        var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
3826          match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
3827          !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
3828
3829        // calculate the numbers (first)n+(last) including if they are negative
3830        match[2] = (test[1] + (test[2] || 1)) - 0;
3831        match[3] = test[3] - 0;
3832      }
3833      else if ( match[2] ) {
3834        Sizzle.error( match[0] );
3835      }
3836
3837      // TODO: Move to normal caching system
3838      match[0] = done++;
3839
3840      return match;
3841    },
3842
3843    ATTR: function( match, curLoop, inplace, result, not, isXML ) {
3844      var name = match[1] = match[1].replace( rBackslash, "" );
3845     
3846      if ( !isXML && Expr.attrMap[name] ) {
3847        match[1] = Expr.attrMap[name];
3848      }
3849
3850      // Handle if an un-quoted value was used
3851      match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
3852
3853      if ( match[2] === "~=" ) {
3854        match[4] = " " + match[4] + " ";
3855      }
3856
3857      return match;
3858    },
3859
3860    PSEUDO: function( match, curLoop, inplace, result, not ) {
3861      if ( match[1] === "not" ) {
3862        // If we're dealing with a complex expression, or a simple one
3863        if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
3864          match[3] = Sizzle(match[3], null, null, curLoop);
3865
3866        } else {
3867          var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
3868
3869          if ( !inplace ) {
3870            result.push.apply( result, ret );
3871          }
3872
3873          return false;
3874        }
3875
3876      } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
3877        return true;
3878      }
3879     
3880      return match;
3881    },
3882
3883    POS: function( match ) {
3884      match.unshift( true );
3885
3886      return match;
3887    }
3888  },
3889 
3890  filters: {
3891    enabled: function( elem ) {
3892      return elem.disabled === false && elem.type !== "hidden";
3893    },
3894
3895    disabled: function( elem ) {
3896      return elem.disabled === true;
3897    },
3898
3899    checked: function( elem ) {
3900      return elem.checked === true;
3901    },
3902   
3903    selected: function( elem ) {
3904      // Accessing this property makes selected-by-default
3905      // options in Safari work properly
3906      if ( elem.parentNode ) {
3907        elem.parentNode.selectedIndex;
3908      }
3909     
3910      return elem.selected === true;
3911    },
3912
3913    parent: function( elem ) {
3914      return !!elem.firstChild;
3915    },
3916
3917    empty: function( elem ) {
3918      return !elem.firstChild;
3919    },
3920
3921    has: function( elem, i, match ) {
3922      return !!Sizzle( match[3], elem ).length;
3923    },
3924
3925    header: function( elem ) {
3926      return (/h\d/i).test( elem.nodeName );
3927    },
3928
3929    text: function( elem ) {
3930      // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
3931      // use getAttribute instead to test this case
3932      return "text" === elem.getAttribute( 'type' );
3933    },
3934    radio: function( elem ) {
3935      return "radio" === elem.type;
3936    },
3937
3938    checkbox: function( elem ) {
3939      return "checkbox" === elem.type;
3940    },
3941
3942    file: function( elem ) {
3943      return "file" === elem.type;
3944    },
3945    password: function( elem ) {
3946      return "password" === elem.type;
3947    },
3948
3949    submit: function( elem ) {
3950      return "submit" === elem.type;
3951    },
3952
3953    image: function( elem ) {
3954      return "image" === elem.type;
3955    },
3956
3957    reset: function( elem ) {
3958      return "reset" === elem.type;
3959    },
3960
3961    button: function( elem ) {
3962      return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
3963    },
3964
3965    input: function( elem ) {
3966      return (/input|select|textarea|button/i).test( elem.nodeName );
3967    }
3968  },
3969  setFilters: {
3970    first: function( elem, i ) {
3971      return i === 0;
3972    },
3973
3974    last: function( elem, i, match, array ) {
3975      return i === array.length - 1;
3976    },
3977
3978    even: function( elem, i ) {
3979      return i % 2 === 0;
3980    },
3981
3982    odd: function( elem, i ) {
3983      return i % 2 === 1;
3984    },
3985
3986    lt: function( elem, i, match ) {
3987      return i < match[3] - 0;
3988    },
3989
3990    gt: function( elem, i, match ) {
3991      return i > match[3] - 0;
3992    },
3993
3994    nth: function( elem, i, match ) {
3995      return match[3] - 0 === i;
3996    },
3997
3998    eq: function( elem, i, match ) {
3999      return match[3] - 0 === i;
4000    }
4001  },
4002  filter: {
4003    PSEUDO: function( elem, match, i, array ) {
4004      var name = match[1],
4005        filter = Expr.filters[ name ];
4006
4007      if ( filter ) {
4008        return filter( elem, i, match, array );
4009
4010      } else if ( name === "contains" ) {
4011        return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
4012
4013      } else if ( name === "not" ) {
4014        var not = match[3];
4015
4016        for ( var j = 0, l = not.length; j < l; j++ ) {
4017          if ( not[j] === elem ) {
4018            return false;
4019          }
4020        }
4021
4022        return true;
4023
4024      } else {
4025        Sizzle.error( name );
4026      }
4027    },
4028
4029    CHILD: function( elem, match ) {
4030      var type = match[1],
4031        node = elem;
4032
4033      switch ( type ) {
4034        case "only":
4035        case "first":
4036          while ( (node = node.previousSibling) )  {
4037            if ( node.nodeType === 1 ) {
4038              return false;
4039            }
4040          }
4041
4042          if ( type === "first" ) {
4043            return true;
4044          }
4045
4046          node = elem;
4047
4048        case "last":
4049          while ( (node = node.nextSibling) )  {
4050            if ( node.nodeType === 1 ) {
4051              return false;
4052            }
4053          }
4054
4055          return true;
4056
4057        case "nth":
4058          var first = match[2],
4059            last = match[3];
4060
4061          if ( first === 1 && last === 0 ) {
4062            return true;
4063          }
4064         
4065          var doneName = match[0],
4066            parent = elem.parentNode;
4067 
4068          if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
4069            var count = 0;
4070           
4071            for ( node = parent.firstChild; node; node = node.nextSibling ) {
4072              if ( node.nodeType === 1 ) {
4073                node.nodeIndex = ++count;
4074              }
4075            }
4076
4077            parent.sizcache = doneName;
4078          }
4079         
4080          var diff = elem.nodeIndex - last;
4081
4082          if ( first === 0 ) {
4083            return diff === 0;
4084
4085          } else {
4086            return ( diff % first === 0 && diff / first >= 0 );
4087          }
4088      }
4089    },
4090
4091    ID: function( elem, match ) {
4092      return elem.nodeType === 1 && elem.getAttribute("id") === match;
4093    },
4094
4095    TAG: function( elem, match ) {
4096      return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
4097    },
4098   
4099    CLASS: function( elem, match ) {
4100      return (" " + (elem.className || elem.getAttribute("class")) + " ")
4101        .indexOf( match ) > -1;
4102    },
4103
4104    ATTR: function( elem, match ) {
4105      var name = match[1],
4106        result = Expr.attrHandle[ name ] ?
4107          Expr.attrHandle[ name ]( elem ) :
4108          elem[ name ] != null ?
4109            elem[ name ] :
4110            elem.getAttribute( name ),
4111        value = result + "",
4112        type = match[2],
4113        check = match[4];
4114
4115      return result == null ?
4116        type === "!=" :
4117        type === "=" ?
4118        value === check :
4119        type === "*=" ?
4120        value.indexOf(check) >= 0 :
4121        type === "~=" ?
4122        (" " + value + " ").indexOf(check) >= 0 :
4123        !check ?
4124        value && result !== false :
4125        type === "!=" ?
4126        value !== check :
4127        type === "^=" ?
4128        value.indexOf(check) === 0 :
4129        type === "$=" ?
4130        value.substr(value.length - check.length) === check :
4131        type === "|=" ?
4132        value === check || value.substr(0, check.length + 1) === check + "-" :
4133        false;
4134    },
4135
4136    POS: function( elem, match, i, array ) {
4137      var name = match[2],
4138        filter = Expr.setFilters[ name ];
4139
4140      if ( filter ) {
4141        return filter( elem, i, match, array );
4142      }
4143    }
4144  }
4145};
4146
4147var origPOS = Expr.match.POS,
4148  fescape = function(all, num){
4149    return "\\" + (num - 0 + 1);
4150  };
4151
4152for ( var type in Expr.match ) {
4153  Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
4154  Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
4155}
4156
4157var makeArray = function( array, results ) {
4158  array = Array.prototype.slice.call( array, 0 );
4159
4160  if ( results ) {
4161    results.push.apply( results, array );
4162    return results;
4163  }
4164 
4165  return array;
4166};
4167
4168// Perform a simple check to determine if the browser is capable of
4169// converting a NodeList to an array using builtin methods.
4170// Also verifies that the returned array holds DOM nodes
4171// (which is not the case in the Blackberry browser)
4172try {
4173  Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
4174
4175// Provide a fallback method if it does not work
4176} catch( e ) {
4177  makeArray = function( array, results ) {
4178    var i = 0,
4179      ret = results || [];
4180
4181    if ( toString.call(array) === "[object Array]" ) {
4182      Array.prototype.push.apply( ret, array );
4183
4184    } else {
4185      if ( typeof array.length === "number" ) {
4186        for ( var l = array.length; i < l; i++ ) {
4187          ret.push( array[i] );
4188        }
4189
4190      } else {
4191        for ( ; array[i]; i++ ) {
4192          ret.push( array[i] );
4193        }
4194      }
4195    }
4196
4197    return ret;
4198  };
4199}
4200
4201var sortOrder, siblingCheck;
4202
4203if ( document.documentElement.compareDocumentPosition ) {
4204  sortOrder = function( a, b ) {
4205    if ( a === b ) {
4206      hasDuplicate = true;
4207      return 0;
4208    }
4209
4210    if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
4211      return a.compareDocumentPosition ? -1 : 1;
4212    }
4213
4214    return a.compareDocumentPosition(b) & 4 ? -1 : 1;
4215  };
4216
4217} else {
4218  sortOrder = function( a, b ) {
4219    var al, bl,
4220      ap = [],
4221      bp = [],
4222      aup = a.parentNode,
4223      bup = b.parentNode,
4224      cur = aup;
4225
4226    // The nodes are identical, we can exit early
4227    if ( a === b ) {
4228      hasDuplicate = true;
4229      return 0;
4230
4231    // If the nodes are siblings (or identical) we can do a quick check
4232    } else if ( aup === bup ) {
4233      return siblingCheck( a, b );
4234
4235    // If no parents were found then the nodes are disconnected
4236    } else if ( !aup ) {
4237      return -1;
4238
4239    } else if ( !bup ) {
4240      return 1;
4241    }
4242
4243    // Otherwise they're somewhere else in the tree so we need
4244    // to build up a full list of the parentNodes for comparison
4245    while ( cur ) {
4246      ap.unshift( cur );
4247      cur = cur.parentNode;
4248    }
4249
4250    cur = bup;
4251
4252    while ( cur ) {
4253      bp.unshift( cur );
4254      cur = cur.parentNode;
4255    }
4256
4257    al = ap.length;
4258    bl = bp.length;
4259
4260    // Start walking down the tree looking for a discrepancy
4261    for ( var i = 0; i < al && i < bl; i++ ) {
4262      if ( ap[i] !== bp[i] ) {
4263        return siblingCheck( ap[i], bp[i] );
4264      }
4265    }
4266
4267    // We ended someplace up the tree so do a sibling check
4268    return i === al ?
4269      siblingCheck( a, bp[i], -1 ) :
4270      siblingCheck( ap[i], b, 1 );
4271  };
4272
4273  siblingCheck = function( a, b, ret ) {
4274    if ( a === b ) {
4275      return ret;
4276    }
4277
4278    var cur = a.nextSibling;
4279
4280    while ( cur ) {
4281      if ( cur === b ) {
4282        return -1;
4283      }
4284
4285      cur = cur.nextSibling;
4286    }
4287
4288    return 1;
4289  };
4290}
4291
4292// Utility function for retreiving the text value of an array of DOM nodes
4293Sizzle.getText = function( elems ) {
4294  var ret = "", elem;
4295
4296  for ( var i = 0; elems[i]; i++ ) {
4297    elem = elems[i];
4298
4299    // Get the text from text nodes and CDATA nodes
4300    if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
4301      ret += elem.nodeValue;
4302
4303    // Traverse everything else, except comment nodes
4304    } else if ( elem.nodeType !== 8 ) {
4305      ret += Sizzle.getText( elem.childNodes );
4306    }
4307  }
4308
4309  return ret;
4310};
4311
4312// Check to see if the browser returns elements by name when
4313// querying by getElementById (and provide a workaround)
4314(function(){
4315  // We're going to inject a fake input element with a specified name
4316  var form = document.createElement("div"),
4317    id = "script" + (new Date()).getTime(),
4318    root = document.documentElement;
4319
4320  form.innerHTML = "<a name='" + id + "'/>";
4321
4322  // Inject it into the root element, check its status, and remove it quickly
4323  root.insertBefore( form, root.firstChild );
4324
4325  // The workaround has to do additional checks after a getElementById
4326  // Which slows things down for other browsers (hence the branching)
4327  if ( document.getElementById( id ) ) {
4328    Expr.find.ID = function( match, context, isXML ) {
4329      if ( typeof context.getElementById !== "undefined" && !isXML ) {
4330        var m = context.getElementById(match[1]);
4331
4332        return m ?
4333          m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
4334            [m] :
4335            undefined :
4336          [];
4337      }
4338    };
4339
4340    Expr.filter.ID = function( elem, match ) {
4341      var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
4342
4343      return elem.nodeType === 1 && node && node.nodeValue === match;
4344    };
4345  }
4346
4347  root.removeChild( form );
4348
4349  // release memory in IE
4350  root = form = null;
4351})();
4352
4353(function(){
4354  // Check to see if the browser returns only elements
4355  // when doing getElementsByTagName("*")
4356
4357  // Create a fake element
4358  var div = document.createElement("div");
4359  div.appendChild( document.createComment("") );
4360
4361  // Make sure no comments are found
4362  if ( div.getElementsByTagName("*").length > 0 ) {
4363    Expr.find.TAG = function( match, context ) {
4364      var results = context.getElementsByTagName( match[1] );
4365
4366      // Filter out possible comments
4367      if ( match[1] === "*" ) {
4368        var tmp = [];
4369
4370        for ( var i = 0; results[i]; i++ ) {
4371          if ( results[i].nodeType === 1 ) {
4372            tmp.push( results[i] );
4373          }
4374        }
4375
4376        results = tmp;
4377      }
4378
4379      return results;
4380    };
4381  }
4382
4383  // Check to see if an attribute returns normalized href attributes
4384  div.innerHTML = "<a href='#'></a>";
4385
4386  if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
4387      div.firstChild.getAttribute("href") !== "#" ) {
4388
4389    Expr.attrHandle.href = function( elem ) {
4390      return elem.getAttribute( "href", 2 );
4391    };
4392  }
4393
4394  // release memory in IE
4395  div = null;
4396})();
4397
4398if ( document.querySelectorAll ) {
4399  (function(){
4400    var oldSizzle = Sizzle,
4401      div = document.createElement("div"),
4402      id = "__sizzle__";
4403
4404    div.innerHTML = "<p class='TEST'></p>";
4405
4406    // Safari can't handle uppercase or unicode characters when
4407    // in quirks mode.
4408    if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
4409      return;
4410    }
4411 
4412    Sizzle = function( query, context, extra, seed ) {
4413      context = context || document;
4414
4415      // Only use querySelectorAll on non-XML documents
4416      // (ID selectors don't work in non-HTML documents)
4417      if ( !seed && !Sizzle.isXML(context) ) {
4418        // See if we find a selector to speed up
4419        var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
4420       
4421        if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
4422          // Speed-up: Sizzle("TAG")
4423          if ( match[1] ) {
4424            return makeArray( context.getElementsByTagName( query ), extra );
4425         
4426          // Speed-up: Sizzle(".CLASS")
4427          } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
4428            return makeArray( context.getElementsByClassName( match[2] ), extra );
4429          }
4430        }
4431       
4432        if ( context.nodeType === 9 ) {
4433          // Speed-up: Sizzle("body")
4434          // The body element only exists once, optimize finding it
4435          if ( query === "body" && context.body ) {
4436            return makeArray( [ context.body ], extra );
4437           
4438          // Speed-up: Sizzle("#ID")
4439          } else if ( match && match[3] ) {
4440            var elem = context.getElementById( match[3] );
4441
4442            // Check parentNode to catch when Blackberry 4.6 returns
4443            // nodes that are no longer in the document #6963
4444            if ( elem && elem.parentNode ) {
4445              // Handle the case where IE and Opera return items
4446              // by name instead of ID
4447              if ( elem.id === match[3] ) {
4448                return makeArray( [ elem ], extra );
4449              }
4450             
4451            } else {
4452              return makeArray( [], extra );
4453            }
4454          }
4455         
4456          try {
4457            return makeArray( context.querySelectorAll(query), extra );
4458          } catch(qsaError) {}
4459
4460        // qSA works strangely on Element-rooted queries
4461        // We can work around this by specifying an extra ID on the root
4462        // and working up from there (Thanks to Andrew Dupont for the technique)
4463        // IE 8 doesn't work on object elements
4464        } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
4465          var oldContext = context,
4466            old = context.getAttribute( "id" ),
4467            nid = old || id,
4468            hasParent = context.parentNode,
4469            relativeHierarchySelector = /^\s*[+~]/.test( query );
4470
4471          if ( !old ) {
4472            context.setAttribute( "id", nid );
4473          } else {
4474            nid = nid.replace( /'/g, "\\$&" );
4475          }
4476          if ( relativeHierarchySelector && hasParent ) {
4477            context = context.parentNode;
4478          }
4479
4480          try {
4481            if ( !relativeHierarchySelector || hasParent ) {
4482              return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
4483            }
4484
4485          } catch(pseudoError) {
4486          } finally {
4487            if ( !old ) {
4488              oldContext.removeAttribute( "id" );
4489            }
4490          }
4491        }
4492      }
4493   
4494      return oldSizzle(query, context, extra, seed);
4495    };
4496
4497    for ( var prop in oldSizzle ) {
4498      Sizzle[ prop ] = oldSizzle[ prop ];
4499    }
4500
4501    // release memory in IE
4502    div = null;
4503  })();
4504}
4505
4506(function(){
4507  var html = document.documentElement,
4508    matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
4509    pseudoWorks = false;
4510
4511  try {
4512    // This should fail with an exception
4513    // Gecko does not error, returns false instead
4514    matches.call( document.documentElement, "[test!='']:sizzle" );
4515 
4516  } catch( pseudoError ) {
4517    pseudoWorks = true;
4518  }
4519
4520  if ( matches ) {
4521    Sizzle.matchesSelector = function( node, expr ) {
4522      // Make sure that attribute selectors are quoted
4523      expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
4524
4525      if ( !Sizzle.isXML( node ) ) {
4526        try {
4527          if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
4528            return matches.call( node, expr );
4529          }
4530        } catch(e) {}
4531      }
4532
4533      return Sizzle(expr, null, null, [node]).length > 0;
4534    };
4535  }
4536})();
4537
4538(function(){
4539  var div = document.createElement("div");
4540
4541  div.innerHTML = "<div class='test e'></div><div class='test'></div>";
4542
4543  // Opera can't find a second classname (in 9.6)
4544  // Also, make sure that getElementsByClassName actually exists
4545  if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
4546    return;
4547  }
4548
4549  // Safari caches class attributes, doesn't catch changes (in 3.2)
4550  div.lastChild.className = "e";
4551
4552  if ( div.getElementsByClassName("e").length === 1 ) {
4553    return;
4554  }
4555 
4556  Expr.order.splice(1, 0, "CLASS");
4557  Expr.find.CLASS = function( match, context, isXML ) {
4558    if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
4559      return context.getElementsByClassName(match[1]);
4560    }
4561  };
4562
4563  // release memory in IE
4564  div = null;
4565})();
4566
4567function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
4568  for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4569    var elem = checkSet[i];
4570
4571    if ( elem ) {
4572      var match = false;
4573
4574      elem = elem[dir];
4575
4576      while ( elem ) {
4577        if ( elem.sizcache === doneName ) {
4578          match = checkSet[elem.sizset];
4579          break;
4580        }
4581
4582        if ( elem.nodeType === 1 && !isXML ){
4583          elem.sizcache = doneName;
4584          elem.sizset = i;
4585        }
4586
4587        if ( elem.nodeName.toLowerCase() === cur ) {
4588          match = elem;
4589          break;
4590        }
4591
4592        elem = elem[dir];
4593      }
4594
4595      checkSet[i] = match;
4596    }
4597  }
4598}
4599
4600function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
4601  for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4602    var elem = checkSet[i];
4603
4604    if ( elem ) {
4605      var match = false;
4606     
4607      elem = elem[dir];
4608
4609      while ( elem ) {
4610        if ( elem.sizcache === doneName ) {
4611          match = checkSet[elem.sizset];
4612          break;
4613        }
4614
4615        if ( elem.nodeType === 1 ) {
4616          if ( !isXML ) {
4617            elem.sizcache = doneName;
4618            elem.sizset = i;
4619          }
4620
4621          if ( typeof cur !== "string" ) {
4622            if ( elem === cur ) {
4623              match = true;
4624              break;
4625            }
4626
4627          } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
4628            match = elem;
4629            break;
4630          }
4631        }
4632
4633        elem = elem[dir];
4634      }
4635
4636      checkSet[i] = match;
4637    }
4638  }
4639}
4640
4641if ( document.documentElement.contains ) {
4642  Sizzle.contains = function( a, b ) {
4643    return a !== b && (a.contains ? a.contains(b) : true);
4644  };
4645
4646} else if ( document.documentElement.compareDocumentPosition ) {
4647  Sizzle.contains = function( a, b ) {
4648    return !!(a.compareDocumentPosition(b) & 16);
4649  };
4650
4651} else {
4652  Sizzle.contains = function() {
4653    return false;
4654  };
4655}
4656
4657Sizzle.isXML = function( elem ) {
4658  // documentElement is verified for cases where it doesn't yet exist
4659  // (such as loading iframes in IE - #4833)
4660  var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
4661
4662  return documentElement ? documentElement.nodeName !== "HTML" : false;
4663};
4664
4665var posProcess = function( selector, context ) {
4666  var match,
4667    tmpSet = [],
4668    later = "",
4669    root = context.nodeType ? [context] : context;
4670
4671  // Position selectors must be done after the filter
4672  // And so must :not(positional) so we move all PSEUDOs to the end
4673  while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
4674    later += match[0];
4675    selector = selector.replace( Expr.match.PSEUDO, "" );
4676  }
4677
4678  selector = Expr.relative[selector] ? selector + "*" : selector;
4679
4680  for ( var i = 0, l = root.length; i < l; i++ ) {
4681    Sizzle( selector, root[i], tmpSet );
4682  }
4683
4684  return Sizzle.filter( later, tmpSet );
4685};
4686
4687// EXPOSE
4688jQuery.find = Sizzle;
4689jQuery.expr = Sizzle.selectors;
4690jQuery.expr[":"] = jQuery.expr.filters;
4691jQuery.unique = Sizzle.uniqueSort;
4692jQuery.text = Sizzle.getText;
4693jQuery.isXMLDoc = Sizzle.isXML;
4694jQuery.contains = Sizzle.contains;
4695
4696
4697})();
4698
4699
4700var runtil = /Until$/,
4701  rparentsprev = /^(?:parents|prevUntil|prevAll)/,
4702  // Note: This RegExp should be improved, or likely pulled from Sizzle
4703  rmultiselector = /,/,
4704  isSimple = /^.[^:#\[\.,]*$/,
4705  slice = Array.prototype.slice,
4706  POS = jQuery.expr.match.POS,
4707  // methods guaranteed to produce a unique set when starting from a unique set
4708  guaranteedUnique = {
4709    children: true,
4710    contents: true,
4711    next: true,
4712    prev: true
4713  };
4714
4715jQuery.fn.extend({
4716  find: function( selector ) {
4717    var ret = this.pushStack( "", "find", selector ),
4718      length = 0;
4719
4720    for ( var i = 0, l = this.length; i < l; i++ ) {
4721      length = ret.length;
4722      jQuery.find( selector, this[i], ret );
4723
4724      if ( i > 0 ) {
4725        // Make sure that the results are unique
4726        for ( var n = length; n < ret.length; n++ ) {
4727          for ( var r = 0; r < length; r++ ) {
4728            if ( ret[r] === ret[n] ) {
4729              ret.splice(n--, 1);
4730              break;
4731            }
4732          }
4733        }
4734      }
4735    }
4736
4737    return ret;
4738  },
4739
4740  has: function( target ) {
4741    var targets = jQuery( target );
4742    return this.filter(function() {
4743      for ( var i = 0, l = targets.length; i < l; i++ ) {
4744        if ( jQuery.contains( this, targets[i] ) ) {
4745          return true;
4746        }
4747      }
4748    });
4749  },
4750
4751  not: function( selector ) {
4752    return this.pushStack( winnow(this, selector, false), "not", selector);
4753  },
4754
4755  filter: function( selector ) {
4756    return this.pushStack( winnow(this, selector, true), "filter", selector );
4757  },
4758
4759  is: function( selector ) {
4760    return !!selector && jQuery.filter( selector, this ).length > 0;
4761  },
4762
4763  closest: function( selectors, context ) {
4764    var ret = [], i, l, cur = this[0];
4765
4766    if ( jQuery.isArray( selectors ) ) {
4767      var match, selector,
4768        matches = {},
4769        level = 1;
4770
4771      if ( cur && selectors.length ) {
4772        for ( i = 0, l = selectors.length; i < l; i++ ) {
4773          selector = selectors[i];
4774
4775          if ( !matches[selector] ) {
4776            matches[selector] = jQuery.expr.match.POS.test( selector ) ?
4777              jQuery( selector, context || this.context ) :
4778              selector;
4779          }
4780        }
4781
4782        while ( cur && cur.ownerDocument && cur !== context ) {
4783          for ( selector in matches ) {
4784            match = matches[selector];
4785
4786            if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
4787              ret.push({ selector: selector, elem: cur, level: level });
4788            }
4789          }
4790
4791          cur = cur.parentNode;
4792          level++;
4793        }
4794      }
4795
4796      return ret;
4797    }
4798
4799    var pos = POS.test( selectors ) ?
4800      jQuery( selectors, context || this.context ) : null;
4801
4802    for ( i = 0, l = this.length; i < l; i++ ) {
4803      cur = this[i];
4804
4805      while ( cur ) {
4806        if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
4807          ret.push( cur );
4808          break;
4809
4810        } else {
4811          cur = cur.parentNode;
4812          if ( !cur || !cur.ownerDocument || cur === context ) {
4813            break;
4814          }
4815        }
4816      }
4817    }
4818
4819    ret = ret.length > 1 ? jQuery.unique(ret) : ret;
4820
4821    return this.pushStack( ret, "closest", selectors );
4822  },
4823
4824  // Determine the position of an element within
4825  // the matched set of elements
4826  index: function( elem ) {
4827    if ( !elem || typeof elem === "string" ) {
4828      return jQuery.inArray( this[0],
4829        // If it receives a string, the selector is used
4830        // If it receives nothing, the siblings are used
4831        elem ? jQuery( elem ) : this.parent().children() );
4832    }
4833    // Locate the position of the desired element
4834    return jQuery.inArray(
4835      // If it receives a jQuery object, the first element is used
4836      elem.jquery ? elem[0] : elem, this );
4837  },
4838
4839  add: function( selector, context ) {
4840    var set = typeof selector === "string" ?
4841        jQuery( selector, context ) :
4842        jQuery.makeArray( selector ),
4843      all = jQuery.merge( this.get(), set );
4844
4845    return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
4846      all :
4847      jQuery.unique( all ) );
4848  },
4849
4850  andSelf: function() {
4851    return this.add( this.prevObject );
4852  }
4853});
4854
4855// A painfully simple check to see if an element is disconnected
4856// from a document (should be improved, where feasible).
4857function isDisconnected( node ) {
4858  return !node || !node.parentNode || node.parentNode.nodeType === 11;
4859}
4860
4861jQuery.each({
4862  parent: function( elem ) {
4863    var parent = elem.parentNode;
4864    return parent && parent.nodeType !== 11 ? parent : null;
4865  },
4866  parents: function( elem ) {
4867    return jQuery.dir( elem, "parentNode" );
4868  },
4869  parentsUntil: function( elem, i, until ) {
4870    return jQuery.dir( elem, "parentNode", until );
4871  },
4872  next: function( elem ) {
4873    return jQuery.nth( elem, 2, "nextSibling" );
4874  },
4875  prev: function( elem ) {
4876    return jQuery.nth( elem, 2, "previousSibling" );
4877  },
4878  nextAll: function( elem ) {
4879    return jQuery.dir( elem, "nextSibling" );
4880  },
4881  prevAll: function( elem ) {
4882    return jQuery.dir( elem, "previousSibling" );
4883  },
4884  nextUntil: function( elem, i, until ) {
4885    return jQuery.dir( elem, "nextSibling", until );
4886  },
4887  prevUntil: function( elem, i, until ) {
4888    return jQuery.dir( elem, "previousSibling", until );
4889  },
4890  siblings: function( elem ) {
4891    return jQuery.sibling( elem.parentNode.firstChild, elem );
4892  },
4893  children: function( elem ) {
4894    return jQuery.sibling( elem.firstChild );
4895  },
4896  contents: function( elem ) {
4897    return jQuery.nodeName( elem, "iframe" ) ?
4898      elem.contentDocument || elem.contentWindow.document :
4899      jQuery.makeArray( elem.childNodes );
4900  }
4901}, function( name, fn ) {
4902  jQuery.fn[ name ] = function( until, selector ) {
4903    var ret = jQuery.map( this, fn, until ),
4904      // The variable 'args' was introduced in
4905      // https://github.com/jquery/jquery/commit/52a0238
4906      // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
4907      // http://code.google.com/p/v8/issues/detail?id=1050
4908      args = slice.call(arguments);
4909
4910    if ( !runtil.test( name ) ) {
4911      selector = until;
4912    }
4913
4914    if ( selector && typeof selector === "string" ) {
4915      ret = jQuery.filter( selector, ret );
4916    }
4917
4918    ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
4919
4920    if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
4921      ret = ret.reverse();
4922    }
4923
4924    return this.pushStack( ret, name, args.join(",") );
4925  };
4926});
4927
4928jQuery.extend({
4929  filter: function( expr, elems, not ) {
4930    if ( not ) {
4931      expr = ":not(" + expr + ")";
4932    }
4933
4934    return elems.length === 1 ?
4935      jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
4936      jQuery.find.matches(expr, elems);
4937  },
4938
4939  dir: function( elem, dir, until ) {
4940    var matched = [],
4941      cur = elem[ dir ];
4942
4943    while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
4944      if ( cur.nodeType === 1 ) {
4945        matched.push( cur );
4946      }
4947      cur = cur[dir];
4948    }
4949    return matched;
4950  },
4951
4952  nth: function( cur, result, dir, elem ) {
4953    result = result || 1;
4954    var num = 0;
4955
4956    for ( ; cur; cur = cur[dir] ) {
4957      if ( cur.nodeType === 1 && ++num === result ) {
4958        break;
4959      }
4960    }
4961
4962    return cur;
4963  },
4964
4965  sibling: function( n, elem ) {
4966    var r = [];
4967
4968    for ( ; n; n = n.nextSibling ) {
4969      if ( n.nodeType === 1 && n !== elem ) {
4970        r.push( n );
4971      }
4972    }
4973
4974    return r;
4975  }
4976});
4977
4978// Implement the identical functionality for filter and not
4979function winnow( elements, qualifier, keep ) {
4980  if ( jQuery.isFunction( qualifier ) ) {
4981    return jQuery.grep(elements, function( elem, i ) {
4982      var retVal = !!qualifier.call( elem, i, elem );
4983      return retVal === keep;
4984    });
4985
4986  } else if ( qualifier.nodeType ) {
4987    return jQuery.grep(elements, function( elem, i ) {
4988      return (elem === qualifier) === keep;
4989    });
4990
4991  } else if ( typeof qualifier === "string" ) {
4992    var filtered = jQuery.grep(elements, function( elem ) {
4993      return elem.nodeType === 1;
4994    });
4995
4996    if ( isSimple.test( qualifier ) ) {
4997      return jQuery.filter(qualifier, filtered, !keep);
4998    } else {
4999      qualifier = jQuery.filter( qualifier, filtered );
5000    }
5001  }
5002
5003  return jQuery.grep(elements, function( elem, i ) {
5004    return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
5005  });
5006}
5007
5008
5009
5010
5011var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
5012  rleadingWhitespace = /^\s+/,
5013  rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
5014  rtagName = /<([\w:]+)/,
5015  rtbody = /<tbody/i,
5016  rhtml = /<|&#?\w+;/,
5017  rnocache = /<(?:script|object|embed|option|style)/i,
5018  // checked="checked" or checked
5019  rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5020  wrapMap = {
5021    option: [ 1, "<select multiple='multiple'>", "</select>" ],
5022    legend: [ 1, "<fieldset>", "</fieldset>" ],
5023    thead: [ 1, "<table>", "</table>" ],
5024    tr: [ 2, "<table><tbody>", "</tbody></table>" ],
5025    td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
5026    col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
5027    area: [ 1, "<map>", "</map>" ],
5028    _default: [ 0, "", "" ]
5029  };
5030
5031wrapMap.optgroup = wrapMap.option;
5032wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
5033wrapMap.th = wrapMap.td;
5034
5035// IE can't serialize <link> and <script> tags normally
5036if ( !jQuery.support.htmlSerialize ) {
5037  wrapMap._default = [ 1, "div<div>", "</div>" ];
5038}
5039
5040jQuery.fn.extend({
5041  text: function( text ) {
5042    if ( jQuery.isFunction(text) ) {
5043      return this.each(function(i) {
5044        var self = jQuery( this );
5045
5046        self.text( text.call(this, i, self.text()) );
5047      });
5048    }
5049
5050    if ( typeof text !== "object" && text !== undefined ) {
5051      return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
5052    }
5053
5054    return jQuery.text( this );
5055  },
5056
5057  wrapAll: function( html ) {
5058    if ( jQuery.isFunction( html ) ) {
5059      return this.each(function(i) {
5060        jQuery(this).wrapAll( html.call(this, i) );
5061      });
5062    }
5063
5064    if ( this[0] ) {
5065      // The elements to wrap the target around
5066      var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
5067
5068      if ( this[0].parentNode ) {
5069        wrap.insertBefore( this[0] );
5070      }
5071
5072      wrap.map(function() {
5073        var elem = this;
5074
5075        while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
5076          elem = elem.firstChild;
5077        }
5078
5079        return elem;
5080      }).append(this);
5081    }
5082
5083    return this;
5084  },
5085
5086  wrapInner: function( html ) {
5087    if ( jQuery.isFunction( html ) ) {
5088      return this.each(function(i) {
5089        jQuery(this).wrapInner( html.call(this, i) );
5090      });
5091    }
5092
5093    return this.each(function() {
5094      var self = jQuery( this ),
5095        contents = self.contents();
5096
5097      if ( contents.length ) {
5098        contents.wrapAll( html );
5099
5100      } else {
5101        self.append( html );
5102      }
5103    });
5104  },
5105
5106  wrap: function( html ) {
5107    return this.each(function() {
5108      jQuery( this ).wrapAll( html );
5109    });
5110  },
5111
5112  unwrap: function() {
5113    return this.parent().each(function() {
5114      if ( !jQuery.nodeName( this, "body" ) ) {
5115        jQuery( this ).replaceWith( this.childNodes );
5116      }
5117    }).end();
5118  },
5119
5120  append: function() {
5121    return this.domManip(arguments, true, function( elem ) {
5122      if ( this.nodeType === 1 ) {
5123        this.appendChild( elem );
5124      }
5125    });
5126  },
5127
5128  prepend: function() {
5129    return this.domManip(arguments, true, function( elem ) {
5130      if ( this.nodeType === 1 ) {
5131        this.insertBefore( elem, this.firstChild );
5132      }
5133    });
5134  },
5135
5136  before: function() {
5137    if ( this[0] && this[0].parentNode ) {
5138      return this.domManip(arguments, false, function( elem ) {
5139        this.parentNode.insertBefore( elem, this );
5140      });
5141    } else if ( arguments.length ) {
5142      var set = jQuery(arguments[0]);
5143      set.push.apply( set, this.toArray() );
5144      return this.pushStack( set, "before", arguments );
5145    }
5146  },
5147
5148  after: function() {
5149    if ( this[0] && this[0].parentNode ) {
5150      return this.domManip(arguments, false, function( elem ) {
5151        this.parentNode.insertBefore( elem, this.nextSibling );
5152      });
5153    } else if ( arguments.length ) {
5154      var set = this.pushStack( this, "after", arguments );
5155      set.push.apply( set, jQuery(arguments[0]).toArray() );
5156      return set;
5157    }
5158  },
5159
5160  // keepData is for internal use only--do not document
5161  remove: function( selector, keepData ) {
5162    for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
5163      if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
5164        if ( !keepData && elem.nodeType === 1 ) {
5165          jQuery.cleanData( elem.getElementsByTagName("*") );
5166          jQuery.cleanData( [ elem ] );
5167        }
5168
5169        if ( elem.parentNode ) {
5170          elem.parentNode.removeChild( elem );
5171        }
5172      }
5173    }
5174
5175    return this;
5176  },
5177
5178  empty: function() {
5179    for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
5180      // Remove element nodes and prevent memory leaks
5181      if ( elem.nodeType === 1 ) {
5182        jQuery.cleanData( elem.getElementsByTagName("*") );
5183      }
5184
5185      // Remove any remaining nodes
5186      while ( elem.firstChild ) {
5187        elem.removeChild( elem.firstChild );
5188      }
5189    }
5190
5191    return this;
5192  },
5193
5194  clone: function( dataAndEvents, deepDataAndEvents ) {
5195    dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5196    deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5197
5198    return this.map( function () {
5199      return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5200    });
5201  },
5202
5203  html: function( value ) {
5204    if ( value === undefined ) {
5205      return this[0] && this[0].nodeType === 1 ?
5206        this[0].innerHTML.replace(rinlinejQuery, "") :
5207        null;
5208
5209    // See if we can take a shortcut and just use innerHTML
5210    } else if ( typeof value === "string" && !rnocache.test( value ) &&
5211      (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
5212      !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
5213
5214      value = value.replace(rxhtmlTag, "<$1></$2>");
5215
5216      try {
5217        for ( var i = 0, l = this.length; i < l; i++ ) {
5218          // Remove element nodes and prevent memory leaks
5219          if ( this[i].nodeType === 1 ) {
5220            jQuery.cleanData( this[i].getElementsByTagName("*") );
5221            this[i].innerHTML = value;
5222          }
5223        }
5224
5225      // If using innerHTML throws an exception, use the fallback method
5226      } catch(e) {
5227        this.empty().append( value );
5228      }
5229
5230    } else if ( jQuery.isFunction( value ) ) {
5231      this.each(function(i){
5232        var self = jQuery( this );
5233
5234        self.html( value.call(this, i, self.html()) );
5235      });
5236
5237    } else {
5238      this.empty().append( value );
5239    }
5240
5241    return this;
5242  },
5243
5244  replaceWith: function( value ) {
5245    if ( this[0] && this[0].parentNode ) {
5246      // Make sure that the elements are removed from the DOM before they are inserted
5247      // this can help fix replacing a parent with child elements
5248      if ( jQuery.isFunction( value ) ) {
5249        return this.each(function(i) {
5250          var self = jQuery(this), old = self.html();
5251          self.replaceWith( value.call( this, i, old ) );
5252        });
5253      }
5254
5255      if ( typeof value !== "string" ) {
5256        value = jQuery( value ).detach();
5257      }
5258
5259      return this.each(function() {
5260        var next = this.nextSibling,
5261          parent = this.parentNode;
5262
5263        jQuery( this ).remove();
5264
5265        if ( next ) {
5266          jQuery(next).before( value );
5267        } else {
5268          jQuery(parent).append( value );
5269        }
5270      });
5271    } else {
5272      return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
5273    }
5274  },
5275
5276  detach: function( selector ) {
5277    return this.remove( selector, true );
5278  },
5279
5280  domManip: function( args, table, callback ) {
5281    var results, first, fragment, parent,
5282      value = args[0],
5283      scripts = [];
5284
5285    // We can't cloneNode fragments that contain checked, in WebKit
5286    if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
5287      return this.each(function() {
5288        jQuery(this).domManip( args, table, callback, true );
5289      });
5290    }
5291
5292    if ( jQuery.isFunction(value) ) {
5293      return this.each(function(i) {
5294        var self = jQuery(this);
5295        args[0] = value.call(this, i, table ? self.html() : undefined);
5296        self.domManip( args, table, callback );
5297      });
5298    }
5299
5300    if ( this[0] ) {
5301      parent = value && value.parentNode;
5302
5303      // If we're in a fragment, just use that instead of building a new one
5304      if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
5305        results = { fragment: parent };
5306
5307      } else {
5308        results = jQuery.buildFragment( args, this, scripts );
5309      }
5310
5311      fragment = results.fragment;
5312
5313      if ( fragment.childNodes.length === 1 ) {
5314        first = fragment = fragment.firstChild;
5315      } else {
5316        first = fragment.firstChild;
5317      }
5318
5319      if ( first ) {
5320        table = table && jQuery.nodeName( first, "tr" );
5321
5322        for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
5323          callback.call(
5324            table ?
5325              root(this[i], first) :
5326              this[i],
5327            // Make sure that we do not leak memory by inadvertently discarding
5328            // the original fragment (which might have attached data) instead of
5329            // using it; in addition, use the original fragment object for the last
5330            // item instead of first because it can end up being emptied incorrectly
5331            // in certain situations (Bug #8070).
5332            // Fragments from the fragment cache must always be cloned and never used
5333            // in place.
5334            results.cacheable || (l > 1 && i < lastIndex) ?
5335              jQuery.clone( fragment, true, true ) :
5336              fragment
5337          );
5338        }
5339      }
5340
5341      if ( scripts.length ) {
5342        jQuery.each( scripts, evalScript );
5343      }
5344    }
5345
5346    return this;
5347  }
5348});
5349
5350function root( elem, cur ) {
5351  return jQuery.nodeName(elem, "table") ?
5352    (elem.getElementsByTagName("tbody")[0] ||
5353    elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
5354    elem;
5355}
5356
5357function cloneCopyEvent( src, dest ) {
5358
5359  if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
5360    return;
5361  }
5362
5363  var internalKey = jQuery.expando,
5364    oldData = jQuery.data( src ),
5365    curData = jQuery.data( dest, oldData );
5366
5367  // Switch to use the internal data object, if it exists, for the next
5368  // stage of data copying
5369  if ( (oldData = oldData[ internalKey ]) ) {
5370    var events = oldData.events;
5371        curData = curData[ internalKey ] = jQuery.extend({}, oldData);
5372
5373    if ( events ) {
5374      delete curData.handle;
5375      curData.events = {};
5376
5377      for ( var type in events ) {
5378        for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
5379          jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
5380        }
5381      }
5382    }
5383  }
5384}
5385
5386function cloneFixAttributes(src, dest) {
5387  // We do not need to do anything for non-Elements
5388  if ( dest.nodeType !== 1 ) {
5389    return;
5390  }
5391
5392  var nodeName = dest.nodeName.toLowerCase();
5393
5394  // clearAttributes removes the attributes, which we don't want,
5395  // but also removes the attachEvent events, which we *do* want
5396  dest.clearAttributes();
5397
5398  // mergeAttributes, in contrast, only merges back on the
5399  // original attributes, not the events
5400  dest.mergeAttributes(src);
5401
5402  // IE6-8 fail to clone children inside object elements that use
5403  // the proprietary classid attribute value (rather than the type
5404  // attribute) to identify the type of content to display
5405  if ( nodeName === "object" ) {
5406    dest.outerHTML = src.outerHTML;
5407
5408  } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
5409    // IE6-8 fails to persist the checked state of a cloned checkbox
5410    // or radio button. Worse, IE6-7 fail to give the cloned element
5411    // a checked appearance if the defaultChecked value isn't also set
5412    if ( src.checked ) {
5413      dest.defaultChecked = dest.checked = src.checked;
5414    }
5415
5416    // IE6-7 get confused and end up setting the value of a cloned
5417    // checkbox/radio button to an empty string instead of "on"
5418    if ( dest.value !== src.value ) {
5419      dest.value = src.value;
5420    }
5421
5422  // IE6-8 fails to return the selected option to the default selected
5423  // state when cloning options
5424  } else if ( nodeName === "option" ) {
5425    dest.selected = src.defaultSelected;
5426
5427  // IE6-8 fails to set the defaultValue to the correct value when
5428  // cloning other types of input fields
5429  } else if ( nodeName === "input" || nodeName === "textarea" ) {
5430    dest.defaultValue = src.defaultValue;
5431  }
5432
5433  // Event data gets referenced instead of copied if the expando
5434  // gets copied too
5435  dest.removeAttribute( jQuery.expando );
5436}
5437
5438jQuery.buildFragment = function( args, nodes, scripts ) {
5439  var fragment, cacheable, cacheresults,
5440    doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
5441
5442  // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
5443  // Cloning options loses the selected state, so don't cache them
5444  // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
5445  // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
5446  if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
5447    args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
5448
5449    cacheable = true;
5450    cacheresults = jQuery.fragments[ args[0] ];
5451    if ( cacheresults ) {
5452      if ( cacheresults !== 1 ) {
5453        fragment = cacheresults;
5454      }
5455    }
5456  }
5457
5458  if ( !fragment ) {
5459    fragment = doc.createDocumentFragment();
5460    jQuery.clean( args, doc, fragment, scripts );
5461  }
5462
5463  if ( cacheable ) {
5464    jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
5465  }
5466
5467  return { fragment: fragment, cacheable: cacheable };
5468};
5469
5470jQuery.fragments = {};
5471
5472jQuery.each({
5473  appendTo: "append",
5474  prependTo: "prepend",
5475  insertBefore: "before",
5476  insertAfter: "after",
5477  replaceAll: "replaceWith"
5478}, function( name, original ) {
5479  jQuery.fn[ name ] = function( selector ) {
5480    var ret = [],
5481      insert = jQuery( selector ),
5482      parent = this.length === 1 && this[0].parentNode;
5483
5484    if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
5485      insert[ original ]( this[0] );
5486      return this;
5487
5488    } else {
5489      for ( var i = 0, l = insert.length; i < l; i++ ) {
5490        var elems = (i > 0 ? this.clone(true) : this).get();
5491        jQuery( insert[i] )[ original ]( elems );
5492        ret = ret.concat( elems );
5493      }
5494
5495      return this.pushStack( ret, name, insert.selector );
5496    }
5497  };
5498});
5499
5500function getAll( elem ) {
5501  if ( "getElementsByTagName" in elem ) {
5502    return elem.getElementsByTagName( "*" );
5503 
5504  } else if ( "querySelectorAll" in elem ) {
5505    return elem.querySelectorAll( "*" );
5506
5507  } else {
5508    return [];
5509  }
5510}
5511
5512jQuery.extend({
5513  clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5514    var clone = elem.cloneNode(true),
5515        srcElements,
5516        destElements,
5517        i;
5518
5519    if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
5520        (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
5521      // IE copies events bound via attachEvent when using cloneNode.
5522      // Calling detachEvent on the clone will also remove the events
5523      // from the original. In order to get around this, we use some
5524      // proprietary methods to clear the events. Thanks to MooTools
5525      // guys for this hotness.
5526
5527      cloneFixAttributes( elem, clone );
5528
5529      // Using Sizzle here is crazy slow, so we use getElementsByTagName
5530      // instead
5531      srcElements = getAll( elem );
5532      destElements = getAll( clone );
5533
5534      // Weird iteration because IE will replace the length property
5535      // with an element if you are cloning the body and one of the
5536      // elements on the page has a name or id of "length"
5537      for ( i = 0; srcElements[i]; ++i ) {
5538        cloneFixAttributes( srcElements[i], destElements[i] );
5539      }
5540    }
5541
5542    // Copy the events from the original to the clone
5543    if ( dataAndEvents ) {
5544      cloneCopyEvent( elem, clone );
5545
5546      if ( deepDataAndEvents ) {
5547        srcElements = getAll( elem );
5548        destElements = getAll( clone );
5549
5550        for ( i = 0; srcElements[i]; ++i ) {
5551          cloneCopyEvent( srcElements[i], destElements[i] );
5552        }
5553      }
5554    }
5555
5556    // Return the cloned set
5557    return clone;
5558},
5559  clean: function( elems, context, fragment, scripts ) {
5560    context = context || document;
5561
5562    // !context.createElement fails in IE with an error but returns typeof 'object'
5563    if ( typeof context.createElement === "undefined" ) {
5564      context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
5565    }
5566
5567    var ret = [];
5568
5569    for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
5570      if ( typeof elem === "number" ) {
5571        elem += "";
5572      }
5573
5574      if ( !elem ) {
5575        continue;
5576      }
5577
5578      // Convert html string into DOM nodes
5579      if ( typeof elem === "string" && !rhtml.test( elem ) ) {
5580        elem = context.createTextNode( elem );
5581
5582      } else if ( typeof elem === "string" ) {
5583        // Fix "XHTML"-style tags in all browsers
5584        elem = elem.replace(rxhtmlTag, "<$1></$2>");
5585
5586        // Trim whitespace, otherwise indexOf won't work as expected
5587        var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
5588          wrap = wrapMap[ tag ] || wrapMap._default,
5589          depth = wrap[0],
5590          div = context.createElement("div");
5591
5592        // Go to html and back, then peel off extra wrappers
5593        div.innerHTML = wrap[1] + elem + wrap[2];
5594
5595        // Move to the right depth
5596        while ( depth-- ) {
5597          div = div.lastChild;
5598        }
5599
5600        // Remove IE's autoinserted <tbody> from table fragments
5601        if ( !jQuery.support.tbody ) {
5602
5603          // String was a <table>, *may* have spurious <tbody>
5604          var hasBody = rtbody.test(elem),
5605            tbody = tag === "table" && !hasBody ?
5606              div.firstChild && div.firstChild.childNodes :
5607
5608              // String was a bare <thead> or <tfoot>
5609              wrap[1] === "<table>" && !hasBody ?
5610                div.childNodes :
5611                [];
5612
5613          for ( var j = tbody.length - 1; j >= 0 ; --j ) {
5614            if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
5615              tbody[ j ].parentNode.removeChild( tbody[ j ] );
5616            }
5617          }
5618
5619        }
5620
5621        // IE completely kills leading whitespace when innerHTML is used
5622        if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
5623          div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
5624        }
5625
5626        elem = div.childNodes;
5627      }
5628
5629      if ( elem.nodeType ) {
5630        ret.push( elem );
5631      } else {
5632        ret = jQuery.merge( ret, elem );
5633      }
5634    }
5635
5636    if ( fragment ) {
5637      for ( i = 0; ret[i]; i++ ) {
5638        if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
5639          scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
5640
5641        } else {
5642          if ( ret[i].nodeType === 1 ) {
5643            ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
5644          }
5645          fragment.appendChild( ret[i] );
5646        }
5647      }
5648    }
5649
5650    return ret;
5651  },
5652
5653  cleanData: function( elems ) {
5654    var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
5655      deleteExpando = jQuery.support.deleteExpando;
5656
5657    for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
5658      if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
5659        continue;
5660      }
5661
5662      id = elem[ jQuery.expando ];
5663
5664      if ( id ) {
5665        data = cache[ id ] && cache[ id ][ internalKey ];
5666
5667        if ( data && data.events ) {
5668          for ( var type in data.events ) {
5669            if ( special[ type ] ) {
5670              jQuery.event.remove( elem, type );
5671
5672            // This is a shortcut to avoid jQuery.event.remove's overhead
5673            } else {
5674              jQuery.removeEvent( elem, type, data.handle );
5675            }
5676          }
5677
5678          // Null the DOM reference to avoid IE6/7/8 leak (#7054)
5679          if ( data.handle ) {
5680            data.handle.elem = null;
5681          }
5682        }
5683
5684        if ( deleteExpando ) {
5685          delete elem[ jQuery.expando ];
5686
5687        } else if ( elem.removeAttribute ) {
5688          elem.removeAttribute( jQuery.expando );
5689        }
5690
5691        delete cache[ id ];
5692      }
5693    }
5694  }
5695});
5696
5697function evalScript( i, elem ) {
5698  if ( elem.src ) {
5699    jQuery.ajax({
5700      url: elem.src,
5701      async: false,
5702      dataType: "script"
5703    });
5704  } else {
5705    jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
5706  }
5707
5708  if ( elem.parentNode ) {
5709    elem.parentNode.removeChild( elem );
5710  }
5711}
5712
5713
5714
5715
5716var ralpha = /alpha\([^)]*\)/i,
5717  ropacity = /opacity=([^)]*)/,
5718  rdashAlpha = /-([a-z])/ig,
5719  rupper = /([A-Z])/g,
5720  rnumpx = /^-?\d+(?:px)?$/i,
5721  rnum = /^-?\d/,
5722
5723  cssShow = { position: "absolute", visibility: "hidden", display: "block" },
5724  cssWidth = [ "Left", "Right" ],
5725  cssHeight = [ "Top", "Bottom" ],
5726  curCSS,
5727
5728  getComputedStyle,
5729  currentStyle,
5730
5731  fcamelCase = function( all, letter ) {
5732    return letter.toUpperCase();
5733  };
5734
5735jQuery.fn.css = function( name, value ) {
5736  // Setting 'undefined' is a no-op
5737  if ( arguments.length === 2 && value === undefined ) {
5738    return this;
5739  }
5740
5741  return jQuery.access( this, name, value, true, function( elem, name, value ) {
5742    return value !== undefined ?
5743      jQuery.style( elem, name, value ) :
5744      jQuery.css( elem, name );
5745  });
5746};
5747
5748jQuery.extend({
5749  // Add in style property hooks for overriding the default
5750  // behavior of getting and setting a style property
5751  cssHooks: {
5752    opacity: {
5753      get: function( elem, computed ) {
5754        if ( computed ) {
5755          // We should always get a number back from opacity
5756          var ret = curCSS( elem, "opacity", "opacity" );
5757          return ret === "" ? "1" : ret;
5758
5759        } else {
5760          return elem.style.opacity;
5761        }
5762      }
5763    }
5764  },
5765
5766  // Exclude the following css properties to add px
5767  cssNumber: {
5768    "zIndex": true,
5769    "fontWeight": true,
5770    "opacity": true,
5771    "zoom": true,
5772    "lineHeight": true
5773  },
5774
5775  // Add in properties whose names you wish to fix before
5776  // setting or getting the value
5777  cssProps: {
5778    // normalize float css property
5779    "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
5780  },
5781
5782  // Get and set the style property on a DOM Node
5783  style: function( elem, name, value, extra ) {
5784    // Don't set styles on text and comment nodes
5785    if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
5786      return;
5787    }
5788
5789    // Make sure that we're working with the right name
5790    var ret, origName = jQuery.camelCase( name ),
5791      style = elem.style, hooks = jQuery.cssHooks[ origName ];
5792
5793    name = jQuery.cssProps[ origName ] || origName;
5794
5795    // Check if we're setting a value
5796    if ( value !== undefined ) {
5797      // Make sure that NaN and null values aren't set. See: #7116
5798      if ( typeof value === "number" && isNaN( value ) || value == null ) {
5799        return;
5800      }
5801
5802      // If a number was passed in, add 'px' to the (except for certain CSS properties)
5803      if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
5804        value += "px";
5805      }
5806
5807      // If a hook was provided, use that value, otherwise just set the specified value
5808      if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
5809        // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
5810        // Fixes bug #5509
5811        try {
5812          style[ name ] = value;
5813        } catch(e) {}
5814      }
5815
5816    } else {
5817      // If a hook was provided get the non-computed value from there
5818      if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
5819        return ret;
5820      }
5821
5822      // Otherwise just get the value from the style object
5823      return style[ name ];
5824    }
5825  },
5826
5827  css: function( elem, name, extra ) {
5828    // Make sure that we're working with the right name
5829    var ret, origName = jQuery.camelCase( name ),
5830      hooks = jQuery.cssHooks[ origName ];
5831
5832    name = jQuery.cssProps[ origName ] || origName;
5833
5834    // If a hook was provided get the computed value from there
5835    if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
5836      return ret;
5837
5838    // Otherwise, if a way to get the computed value exists, use that
5839    } else if ( curCSS ) {
5840      return curCSS( elem, name, origName );
5841    }
5842  },
5843
5844  // A method for quickly swapping in/out CSS properties to get correct calculations
5845  swap: function( elem, options, callback ) {
5846    var old = {};
5847
5848    // Remember the old values, and insert the new ones
5849    for ( var name in options ) {
5850      old[ name ] = elem.style[ name ];
5851      elem.style[ name ] = options[ name ];
5852    }
5853
5854    callback.call( elem );
5855
5856    // Revert the old values
5857    for ( name in options ) {
5858      elem.style[ name ] = old[ name ];
5859    }
5860  },
5861
5862  camelCase: function( string ) {
5863    return string.replace( rdashAlpha, fcamelCase );
5864  }
5865});
5866
5867// DEPRECATED, Use jQuery.css() instead
5868jQuery.curCSS = jQuery.css;
5869
5870jQuery.each(["height", "width"], function( i, name ) {
5871  jQuery.cssHooks[ name ] = {
5872    get: function( elem, computed, extra ) {
5873      var val;
5874
5875      if ( computed ) {
5876        if ( elem.offsetWidth !== 0 ) {
5877          val = getWH( elem, name, extra );
5878
5879        } else {
5880          jQuery.swap( elem, cssShow, function() {
5881            val = getWH( elem, name, extra );
5882          });
5883        }
5884
5885        if ( val <= 0 ) {
5886          val = curCSS( elem, name, name );
5887
5888          if ( val === "0px" && currentStyle ) {
5889            val = currentStyle( elem, name, name );
5890          }
5891
5892          if ( val != null ) {
5893            // Should return "auto" instead of 0, use 0 for
5894            // temporary backwards-compat
5895            return val === "" || val === "auto" ? "0px" : val;
5896          }
5897        }
5898
5899        if ( val < 0 || val == null ) {
5900          val = elem.style[ name ];
5901
5902          // Should return "auto" instead of 0, use 0 for
5903          // temporary backwards-compat
5904          return val === "" || val === "auto" ? "0px" : val;
5905        }
5906
5907        return typeof val === "string" ? val : val + "px";
5908      }
5909    },
5910
5911    set: function( elem, value ) {
5912      if ( rnumpx.test( value ) ) {
5913        // ignore negative width and height values #1599
5914        value = parseFloat(value);
5915
5916        if ( value >= 0 ) {
5917          return value + "px";
5918        }
5919
5920      } else {
5921        return value;
5922      }
5923    }
5924  };
5925});
5926
5927if ( !jQuery.support.opacity ) {
5928  jQuery.cssHooks.opacity = {
5929    get: function( elem, computed ) {
5930      // IE uses filters for opacity
5931      return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
5932        (parseFloat(RegExp.$1) / 100) + "" :
5933        computed ? "1" : "";
5934    },
5935
5936    set: function( elem, value ) {
5937      var style = elem.style;
5938
5939      // IE has trouble with opacity if it does not have layout
5940      // Force it by setting the zoom level
5941      style.zoom = 1;
5942
5943      // Set the alpha filter to set the opacity
5944      var opacity = jQuery.isNaN(value) ?
5945        "" :
5946        "alpha(opacity=" + value * 100 + ")",
5947        filter = style.filter || "";
5948
5949      style.filter = ralpha.test(filter) ?
5950        filter.replace(ralpha, opacity) :
5951        style.filter + ' ' + opacity;
5952    }
5953  };
5954}
5955
5956if ( document.defaultView && document.defaultView.getComputedStyle ) {
5957  getComputedStyle = function( elem, newName, name ) {
5958    var ret, defaultView, computedStyle;
5959
5960    name = name.replace( rupper, "-$1" ).toLowerCase();
5961
5962    if ( !(defaultView = elem.ownerDocument.defaultView) ) {
5963      return undefined;
5964    }
5965
5966    if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
5967      ret = computedStyle.getPropertyValue( name );
5968      if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
5969        ret = jQuery.style( elem, name );
5970      }
5971    }
5972
5973    return ret;
5974  };
5975}
5976
5977if ( document.documentElement.currentStyle ) {
5978  currentStyle = function( elem, name ) {
5979    var left,
5980      ret = elem.currentStyle && elem.currentStyle[ name ],
5981      rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
5982      style = elem.style;
5983
5984    // From the awesome hack by Dean Edwards
5985    // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
5986
5987    // If we're not dealing with a regular pixel number
5988    // but a number that has a weird ending, we need to convert it to pixels
5989    if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
5990      // Remember the original values
5991      left = style.left;
5992
5993      // Put in the new values to get a computed value out
5994      if ( rsLeft ) {
5995        elem.runtimeStyle.left = elem.currentStyle.left;
5996      }
5997      style.left = name === "fontSize" ? "1em" : (ret || 0);
5998      ret = style.pixelLeft + "px";
5999
6000      // Revert the changed values
6001      style.left = left;
6002      if ( rsLeft ) {
6003        elem.runtimeStyle.left = rsLeft;
6004      }
6005    }
6006
6007    return ret === "" ? "auto" : ret;
6008  };
6009}
6010
6011curCSS = getComputedStyle || currentStyle;
6012
6013function getWH( elem, name, extra ) {
6014  var which = name === "width" ? cssWidth : cssHeight,
6015    val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
6016
6017  if ( extra === "border" ) {
6018    return val;
6019  }
6020
6021  jQuery.each( which, function() {
6022    if ( !extra ) {
6023      val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
6024    }
6025
6026    if ( extra === "margin" ) {
6027      val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
6028
6029    } else {
6030      val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
6031    }
6032  });
6033
6034  return val;
6035}
6036
6037if ( jQuery.expr && jQuery.expr.filters ) {
6038  jQuery.expr.filters.hidden = function( elem ) {
6039    var width = elem.offsetWidth,
6040      height = elem.offsetHeight;
6041
6042    return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
6043  };
6044
6045  jQuery.expr.filters.visible = function( elem ) {
6046    return !jQuery.expr.filters.hidden( elem );
6047  };
6048}
6049
6050
6051
6052
6053var r20 = /%20/g,
6054  rbracket = /\[\]$/,
6055  rCRLF = /\r?\n/g,
6056  rhash = /#.*$/,
6057  rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
6058  rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
6059  // #7653, #8125, #8152: local protocol detection
6060  rlocalProtocol = /(?:^file|^widget|\-extension):$/,
6061  rnoContent = /^(?:GET|HEAD)$/,
6062  rprotocol = /^\/\//,
6063  rquery = /\?/,
6064  rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
6065  rselectTextarea = /^(?:select|textarea)/i,
6066  rspacesAjax = /\s+/,
6067  rts = /([?&])_=[^&]*/,
6068  rucHeaders = /(^|\-)([a-z])/g,
6069  rucHeadersFunc = function( _, $1, $2 ) {
6070    return $1 + $2.toUpperCase();
6071  },
6072  rurl = /^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,
6073
6074  // Keep a copy of the old load method
6075  _load = jQuery.fn.load,
6076
6077  /* Prefilters
6078   * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
6079   * 2) These are called:
6080   *    - BEFORE asking for a transport
6081   *    - AFTER param serialization (s.data is a string if s.processData is true)
6082   * 3) key is the dataType
6083   * 4) the catchall symbol "*" can be used
6084   * 5) execution will start with transport dataType and THEN continue down to "*" if needed
6085   */
6086  prefilters = {},
6087
6088  /* Transports bindings
6089   * 1) key is the dataType
6090   * 2) the catchall symbol "*" can be used
6091   * 3) selection will start with transport dataType and THEN go to "*" if needed
6092   */
6093  transports = {},
6094
6095  // Document location
6096  ajaxLocation,
6097
6098  // Document location segments
6099  ajaxLocParts;
6100
6101// #8138, IE may throw an exception when accessing
6102// a field from document.location if document.domain has been set
6103try {
6104  ajaxLocation = document.location.href;
6105} catch( e ) {
6106  // Use the href attribute of an A element
6107  // since IE will modify it given document.location
6108  ajaxLocation = document.createElement( "a" );
6109  ajaxLocation.href = "";
6110  ajaxLocation = ajaxLocation.href;
6111}
6112
6113// Segment location into parts
6114ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() );
6115
6116// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
6117function addToPrefiltersOrTransports( structure ) {
6118
6119  // dataTypeExpression is optional and defaults to "*"
6120  return function( dataTypeExpression, func ) {
6121
6122    if ( typeof dataTypeExpression !== "string" ) {
6123      func = dataTypeExpression;
6124      dataTypeExpression = "*";
6125    }
6126
6127    if ( jQuery.isFunction( func ) ) {
6128      var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
6129        i = 0,
6130        length = dataTypes.length,
6131        dataType,
6132        list,
6133        placeBefore;
6134
6135      // For each dataType in the dataTypeExpression
6136      for(; i < length; i++ ) {
6137        dataType = dataTypes[ i ];
6138        // We control if we're asked to add before
6139        // any existing element
6140        placeBefore = /^\+/.test( dataType );
6141        if ( placeBefore ) {
6142          dataType = dataType.substr( 1 ) || "*";
6143        }
6144        list = structure[ dataType ] = structure[ dataType ] || [];
6145        // then we add to the structure accordingly
6146        list[ placeBefore ? "unshift" : "push" ]( func );
6147      }
6148    }
6149  };
6150}
6151
6152//Base inspection function for prefilters and transports
6153function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
6154    dataType /* internal */, inspected /* internal */ ) {
6155
6156  dataType = dataType || options.dataTypes[ 0 ];
6157  inspected = inspected || {};
6158
6159  inspected[ dataType ] = true;
6160
6161  var list = structure[ dataType ],
6162    i = 0,
6163    length = list ? list.length : 0,
6164    executeOnly = ( structure === prefilters ),
6165    selection;
6166
6167  for(; i < length && ( executeOnly || !selection ); i++ ) {
6168    selection = list[ i ]( options, originalOptions, jqXHR );
6169    // If we got redirected to another dataType
6170    // we try there if executing only and not done already
6171    if ( typeof selection === "string" ) {
6172      if ( !executeOnly || inspected[ selection ] ) {
6173        selection = undefined;
6174      } else {
6175        options.dataTypes.unshift( selection );
6176        selection = inspectPrefiltersOrTransports(
6177            structure, options, originalOptions, jqXHR, selection, inspected );
6178      }
6179    }
6180  }
6181  // If we're only executing or nothing was selected
6182  // we try the catchall dataType if not done already
6183  if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
6184    selection = inspectPrefiltersOrTransports(
6185        structure, options, originalOptions, jqXHR, "*", inspected );
6186  }
6187  // unnecessary when only executing (prefilters)
6188  // but it'll be ignored by the caller in that case
6189  return selection;
6190}
6191
6192jQuery.fn.extend({
6193  load: function( url, params, callback ) {
6194    if ( typeof url !== "string" && _load ) {
6195      return _load.apply( this, arguments );
6196
6197    // Don't do a request if no elements are being requested
6198    } else if ( !this.length ) {
6199      return this;
6200    }
6201
6202    var off = url.indexOf( " " );
6203    if ( off >= 0 ) {
6204      var selector = url.slice( off, url.length );
6205      url = url.slice( 0, off );
6206    }
6207
6208    // Default to a GET request
6209    var type = "GET";
6210
6211    // If the second parameter was provided
6212    if ( params ) {
6213      // If it's a function
6214      if ( jQuery.isFunction( params ) ) {
6215        // We assume that it's the callback
6216        callback = params;
6217        params = undefined;
6218
6219      // Otherwise, build a param string
6220      } else if ( typeof params === "object" ) {
6221        params = jQuery.param( params, jQuery.ajaxSettings.traditional );
6222        type = "POST";
6223      }
6224    }
6225
6226    var self = this;
6227
6228    // Request the remote document
6229    jQuery.ajax({
6230      url: url,
6231      type: type,
6232      dataType: "html",
6233      data: params,
6234      // Complete callback (responseText is used internally)
6235      complete: function( jqXHR, status, responseText ) {
6236        // Store the response as specified by the jqXHR object
6237        responseText = jqXHR.responseText;
6238        // If successful, inject the HTML into all the matched elements
6239        if ( jqXHR.isResolved() ) {
6240          // #4825: Get the actual response in case
6241          // a dataFilter is present in ajaxSettings
6242          jqXHR.done(function( r ) {
6243            responseText = r;
6244          });
6245          // See if a selector was specified
6246          self.html( selector ?
6247            // Create a dummy div to hold the results
6248            jQuery("<div>")
6249              // inject the contents of the document in, removing the scripts
6250              // to avoid any 'Permission Denied' errors in IE
6251              .append(responseText.replace(rscript, ""))
6252
6253              // Locate the specified elements
6254              .find(selector) :
6255
6256            // If not, just inject the full result
6257            responseText );
6258        }
6259
6260        if ( callback ) {
6261          self.each( callback, [ responseText, status, jqXHR ] );
6262        }
6263      }
6264    });
6265
6266    return this;
6267  },
6268
6269  serialize: function() {
6270    return jQuery.param( this.serializeArray() );
6271  },
6272
6273  serializeArray: function() {
6274    return this.map(function(){
6275      return this.elements ? jQuery.makeArray( this.elements ) : this;
6276    })
6277    .filter(function(){
6278      return this.name && !this.disabled &&
6279        ( this.checked || rselectTextarea.test( this.nodeName ) ||
6280          rinput.test( this.type ) );
6281    })
6282    .map(function( i, elem ){
6283      var val = jQuery( this ).val();
6284
6285      return val == null ?
6286        null :
6287        jQuery.isArray( val ) ?
6288          jQuery.map( val, function( val, i ){
6289            return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6290          }) :
6291          { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6292    }).get();
6293  }
6294});
6295
6296// Attach a bunch of functions for handling common AJAX events
6297jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
6298  jQuery.fn[ o ] = function( f ){
6299    return this.bind( o, f );
6300  };
6301} );
6302
6303jQuery.each( [ "get", "post" ], function( i, method ) {
6304  jQuery[ method ] = function( url, data, callback, type ) {
6305    // shift arguments if data argument was omitted
6306    if ( jQuery.isFunction( data ) ) {
6307      type = type || callback;
6308      callback = data;
6309      data = undefined;
6310    }
6311
6312    return jQuery.ajax({
6313      type: method,
6314      url: url,
6315      data: data,
6316      success: callback,
6317      dataType: type
6318    });
6319  };
6320} );
6321
6322jQuery.extend({
6323
6324  getScript: function( url, callback ) {
6325    return jQuery.get( url, undefined, callback, "script" );
6326  },
6327
6328  getJSON: function( url, data, callback ) {
6329    return jQuery.get( url, data, callback, "json" );
6330  },
6331
6332  // Creates a full fledged settings object into target
6333  // with both ajaxSettings and settings fields.
6334  // If target is omitted, writes into ajaxSettings.
6335  ajaxSetup: function ( target, settings ) {
6336    if ( !settings ) {
6337      // Only one parameter, we extend ajaxSettings
6338      settings = target;
6339      target = jQuery.extend( true, jQuery.ajaxSettings, settings );
6340    } else {
6341      // target was provided, we extend into it
6342      jQuery.extend( true, target, jQuery.ajaxSettings, settings );
6343    }
6344    // Flatten fields we don't want deep extended
6345    for( var field in { context: 1, url: 1 } ) {
6346      if ( field in settings ) {
6347        target[ field ] = settings[ field ];
6348      } else if( field in jQuery.ajaxSettings ) {
6349        target[ field ] = jQuery.ajaxSettings[ field ];
6350      }
6351    }
6352    return target;
6353  },
6354
6355  ajaxSettings: {
6356    url: ajaxLocation,
6357    isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
6358    global: true,
6359    type: "GET",
6360    contentType: "application/x-www-form-urlencoded",
6361    processData: true,
6362    async: true,
6363    /*
6364    timeout: 0,
6365    data: null,
6366    dataType: null,
6367    username: null,
6368    password: null,
6369    cache: null,
6370    traditional: false,
6371    headers: {},
6372    crossDomain: null,
6373    */
6374
6375    accepts: {
6376      xml: "application/xml, text/xml",
6377      html: "text/html",
6378      text: "text/plain",
6379      json: "application/json, text/javascript",
6380      "*": "*/*"
6381    },
6382
6383    contents: {
6384      xml: /xml/,
6385      html: /html/,
6386      json: /json/
6387    },
6388
6389    responseFields: {
6390      xml: "responseXML",
6391      text: "responseText"
6392    },
6393
6394    // List of data converters
6395    // 1) key format is "source_type destination_type" (a single space in-between)
6396    // 2) the catchall symbol "*" can be used for source_type
6397    converters: {
6398
6399      // Convert anything to text
6400      "* text": window.String,
6401
6402      // Text to html (true = no transformation)
6403      "text html": true,
6404
6405      // Evaluate text as a json expression
6406      "text json": jQuery.parseJSON,
6407
6408      // Parse text as xml
6409      "text xml": jQuery.parseXML
6410    }
6411  },
6412
6413  ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
6414  ajaxTransport: addToPrefiltersOrTransports( transports ),
6415
6416  // Main method
6417  ajax: function( url, options ) {
6418
6419    // If url is an object, simulate pre-1.5 signature
6420    if ( typeof url === "object" ) {
6421      options = url;
6422      url = undefined;
6423    }
6424
6425    // Force options to be an object
6426    options = options || {};
6427
6428    var // Create the final options object
6429      s = jQuery.ajaxSetup( {}, options ),
6430      // Callbacks context
6431      callbackContext = s.context || s,
6432      // Context for global events
6433      // It's the callbackContext if one was provided in the options
6434      // and if it's a DOM node or a jQuery collection
6435      globalEventContext = callbackContext !== s &&
6436        ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
6437            jQuery( callbackContext ) : jQuery.event,
6438      // Deferreds
6439      deferred = jQuery.Deferred(),
6440      completeDeferred = jQuery._Deferred(),
6441      // Status-dependent callbacks
6442      statusCode = s.statusCode || {},
6443      // ifModified key
6444      ifModifiedKey,
6445      // Headers (they are sent all at once)
6446      requestHeaders = {},
6447      // Response headers
6448      responseHeadersString,
6449      responseHeaders,
6450      // transport
6451      transport,
6452      // timeout handle
6453      timeoutTimer,
6454      // Cross-domain detection vars
6455      parts,
6456      // The jqXHR state
6457      state = 0,
6458      // To know if global events are to be dispatched
6459      fireGlobals,
6460      // Loop variable
6461      i,
6462      // Fake xhr
6463      jqXHR = {
6464
6465        readyState: 0,
6466
6467        // Caches the header
6468        setRequestHeader: function( name, value ) {
6469          if ( !state ) {
6470            requestHeaders[ name.toLowerCase().replace( rucHeaders, rucHeadersFunc ) ] = value;
6471          }
6472          return this;
6473        },
6474
6475        // Raw string
6476        getAllResponseHeaders: function() {
6477          return state === 2 ? responseHeadersString : null;
6478        },
6479
6480        // Builds headers hashtable if needed
6481        getResponseHeader: function( key ) {
6482          var match;
6483          if ( state === 2 ) {
6484            if ( !responseHeaders ) {
6485              responseHeaders = {};
6486              while( ( match = rheaders.exec( responseHeadersString ) ) ) {
6487                responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
6488              }
6489            }
6490            match = responseHeaders[ key.toLowerCase() ];
6491          }
6492          return match === undefined ? null : match;
6493        },
6494
6495        // Overrides response content-type header
6496        overrideMimeType: function( type ) {
6497          if ( !state ) {
6498            s.mimeType = type;
6499          }
6500          return this;
6501        },
6502
6503        // Cancel the request
6504        abort: function( statusText ) {
6505          statusText = statusText || "abort";
6506          if ( transport ) {
6507            transport.abort( statusText );
6508          }
6509          done( 0, statusText );
6510          return this;
6511        }
6512      };
6513
6514    // Callback for when everything is done
6515    // It is defined here because jslint complains if it is declared
6516    // at the end of the function (which would be more logical and readable)
6517    function done( status, statusText, responses, headers ) {
6518
6519      // Called once
6520      if ( state === 2 ) {
6521        return;
6522      }
6523
6524      // State is "done" now
6525      state = 2;
6526
6527      // Clear timeout if it exists
6528      if ( timeoutTimer ) {
6529        clearTimeout( timeoutTimer );
6530      }
6531
6532      // Dereference transport for early garbage collection
6533      // (no matter how long the jqXHR object will be used)
6534      transport = undefined;
6535
6536      // Cache response headers
6537      responseHeadersString = headers || "";
6538
6539      // Set readyState
6540      jqXHR.readyState = status ? 4 : 0;
6541
6542      var isSuccess,
6543        success,
6544        error,
6545        response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
6546        lastModified,
6547        etag;
6548
6549      // If successful, handle type chaining
6550      if ( status >= 200 && status < 300 || status === 304 ) {
6551
6552        // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6553        if ( s.ifModified ) {
6554
6555          if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
6556            jQuery.lastModified[ ifModifiedKey ] = lastModified;
6557          }
6558          if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
6559            jQuery.etag[ ifModifiedKey ] = etag;
6560          }
6561        }
6562
6563        // If not modified
6564        if ( status === 304 ) {
6565
6566          statusText = "notmodified";
6567          isSuccess = true;
6568
6569        // If we have data
6570        } else {
6571
6572          try {
6573            success = ajaxConvert( s, response );
6574            statusText = "success";
6575            isSuccess = true;
6576          } catch(e) {
6577            // We have a parsererror
6578            statusText = "parsererror";
6579            error = e;
6580          }
6581        }
6582      } else {
6583        // We extract error from statusText
6584        // then normalize statusText and status for non-aborts
6585        error = statusText;
6586        if( !statusText || status ) {
6587          statusText = "error";
6588          if ( status < 0 ) {
6589            status = 0;
6590          }
6591        }
6592      }
6593
6594      // Set data for the fake xhr object
6595      jqXHR.status = status;
6596      jqXHR.statusText = statusText;
6597
6598      // Success/Error
6599      if ( isSuccess ) {
6600        deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
6601      } else {
6602        deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
6603      }
6604
6605      // Status-dependent callbacks
6606      jqXHR.statusCode( statusCode );
6607      statusCode = undefined;
6608
6609      if ( fireGlobals ) {
6610        globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
6611            [ jqXHR, s, isSuccess ? success : error ] );
6612      }
6613
6614      // Complete
6615      completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
6616
6617      if ( fireGlobals ) {
6618        globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] );
6619        // Handle the global AJAX counter
6620        if ( !( --jQuery.active ) ) {
6621          jQuery.event.trigger( "ajaxStop" );
6622        }
6623      }
6624    }
6625
6626    // Attach deferreds
6627    deferred.promise( jqXHR );
6628    jqXHR.success = jqXHR.done;
6629    jqXHR.error = jqXHR.fail;
6630    jqXHR.complete = completeDeferred.done;
6631
6632    // Status-dependent callbacks
6633    jqXHR.statusCode = function( map ) {
6634      if ( map ) {
6635        var tmp;
6636        if ( state < 2 ) {
6637          for( tmp in map ) {
6638            statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
6639          }
6640        } else {
6641          tmp = map[ jqXHR.status ];
6642          jqXHR.then( tmp, tmp );
6643        }
6644      }
6645      return this;
6646    };
6647
6648    // Remove hash character (#7531: and string promotion)
6649    // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
6650    // We also use the url parameter if available
6651    s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
6652
6653    // Extract dataTypes list
6654    s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
6655
6656    // Determine if a cross-domain request is in order
6657    if ( !s.crossDomain ) {
6658      parts = rurl.exec( s.url.toLowerCase() );
6659      s.crossDomain = !!( parts &&
6660        ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
6661          ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
6662            ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
6663      );
6664    }
6665
6666    // Convert data if not already a string
6667    if ( s.data && s.processData && typeof s.data !== "string" ) {
6668      s.data = jQuery.param( s.data, s.traditional );
6669    }
6670
6671    // Apply prefilters
6672    inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
6673
6674    // If request was aborted inside a prefiler, stop there
6675    if ( state === 2 ) {
6676      return false;
6677    }
6678
6679    // We can fire global events as of now if asked to
6680    fireGlobals = s.global;
6681
6682    // Uppercase the type
6683    s.type = s.type.toUpperCase();
6684
6685    // Determine if request has content
6686    s.hasContent = !rnoContent.test( s.type );
6687
6688    // Watch for a new set of requests
6689    if ( fireGlobals && jQuery.active++ === 0 ) {
6690      jQuery.event.trigger( "ajaxStart" );
6691    }
6692
6693    // More options handling for requests with no content
6694    if ( !s.hasContent ) {
6695
6696      // If data is available, append data to url
6697      if ( s.data ) {
6698        s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
6699      }
6700
6701      // Get ifModifiedKey before adding the anti-cache parameter
6702      ifModifiedKey = s.url;
6703
6704      // Add anti-cache in url if needed
6705      if ( s.cache === false ) {
6706
6707        var ts = jQuery.now(),
6708          // try replacing _= if it is there
6709          ret = s.url.replace( rts, "$1_=" + ts );
6710
6711        // if nothing was replaced, add timestamp to the end
6712        s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
6713      }
6714    }
6715
6716    // Set the correct header, if data is being sent
6717    if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
6718      requestHeaders[ "Content-Type" ] = s.contentType;
6719    }
6720
6721    // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6722    if ( s.ifModified ) {
6723      ifModifiedKey = ifModifiedKey || s.url;
6724      if ( jQuery.lastModified[ ifModifiedKey ] ) {
6725        requestHeaders[ "If-Modified-Since" ] = jQuery.lastModified[ ifModifiedKey ];
6726      }
6727      if ( jQuery.etag[ ifModifiedKey ] ) {
6728        requestHeaders[ "If-None-Match" ] = jQuery.etag[ ifModifiedKey ];
6729      }
6730    }
6731
6732    // Set the Accepts header for the server, depending on the dataType
6733    requestHeaders.Accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
6734      s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
6735      s.accepts[ "*" ];
6736
6737    // Check for headers option
6738    for ( i in s.headers ) {
6739      jqXHR.setRequestHeader( i, s.headers[ i ] );
6740    }
6741
6742    // Allow custom headers/mimetypes and early abort
6743    if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
6744        // Abort if not done already
6745        jqXHR.abort();
6746        return false;
6747
6748    }
6749
6750    // Install callbacks on deferreds
6751    for ( i in { success: 1, error: 1, complete: 1 } ) {
6752      jqXHR[ i ]( s[ i ] );
6753    }
6754
6755    // Get transport
6756    transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
6757
6758    // If no transport, we auto-abort
6759    if ( !transport ) {
6760      done( -1, "No Transport" );
6761    } else {
6762      jqXHR.readyState = 1;
6763      // Send global event
6764      if ( fireGlobals ) {
6765        globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
6766      }
6767      // Timeout
6768      if ( s.async && s.timeout > 0 ) {
6769        timeoutTimer = setTimeout( function(){
6770          jqXHR.abort( "timeout" );
6771        }, s.timeout );
6772      }
6773
6774      try {
6775        state = 1;
6776        transport.send( requestHeaders, done );
6777      } catch (e) {
6778        // Propagate exception as error if not done
6779        if ( status < 2 ) {
6780          done( -1, e );
6781        // Simply rethrow otherwise
6782        } else {
6783          jQuery.error( e );
6784        }
6785      }
6786    }
6787
6788    return jqXHR;
6789  },
6790
6791  // Serialize an array of form elements or a set of
6792  // key/values into a query string
6793  param: function( a, traditional ) {
6794    var s = [],
6795      add = function( key, value ) {
6796        // If value is a function, invoke it and return its value
6797        value = jQuery.isFunction( value ) ? value() : value;
6798        s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
6799      };
6800
6801    // Set traditional to true for jQuery <= 1.3.2 behavior.
6802    if ( traditional === undefined ) {
6803      traditional = jQuery.ajaxSettings.traditional;
6804    }
6805
6806    // If an array was passed in, assume that it is an array of form elements.
6807    if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
6808      // Serialize the form elements
6809      jQuery.each( a, function() {
6810        add( this.name, this.value );
6811      } );
6812
6813    } else {
6814      // If traditional, encode the "old" way (the way 1.3.2 or older
6815      // did it), otherwise encode params recursively.
6816      for ( var prefix in a ) {
6817        buildParams( prefix, a[ prefix ], traditional, add );
6818      }
6819    }
6820
6821    // Return the resulting serialization
6822    return s.join( "&" ).replace( r20, "+" );
6823  }
6824});
6825
6826function buildParams( prefix, obj, traditional, add ) {
6827  if ( jQuery.isArray( obj ) && obj.length ) {
6828    // Serialize array item.
6829    jQuery.each( obj, function( i, v ) {
6830      if ( traditional || rbracket.test( prefix ) ) {
6831        // Treat each array item as a scalar.
6832        add( prefix, v );
6833
6834      } else {
6835        // If array item is non-scalar (array or object), encode its
6836        // numeric index to resolve deserialization ambiguity issues.
6837        // Note that rack (as of 1.0.0) can't currently deserialize
6838        // nested arrays properly, and attempting to do so may cause
6839        // a server error. Possible fixes are to modify rack's
6840        // deserialization algorithm or to provide an option or flag
6841        // to force array serialization to be shallow.
6842        buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
6843      }
6844    });
6845
6846  } else if ( !traditional && obj != null && typeof obj === "object" ) {
6847    // If we see an array here, it is empty and should be treated as an empty
6848    // object
6849    if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) {
6850      add( prefix, "" );
6851
6852    // Serialize object item.
6853    } else {
6854      for ( var name in obj ) {
6855        buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
6856      }
6857    }
6858
6859  } else {
6860    // Serialize scalar item.
6861    add( prefix, obj );
6862  }
6863}
6864
6865// This is still on the jQuery object... for now
6866// Want to move this to jQuery.ajax some day
6867jQuery.extend({
6868
6869  // Counter for holding the number of active queries
6870  active: 0,
6871
6872  // Last-Modified header cache for next request
6873  lastModified: {},
6874  etag: {}
6875
6876});
6877
6878/* Handles responses to an ajax request:
6879 * - sets all responseXXX fields accordingly
6880 * - finds the right dataType (mediates between content-type and expected dataType)
6881 * - returns the corresponding response
6882 */
6883function ajaxHandleResponses( s, jqXHR, responses ) {
6884
6885  var contents = s.contents,
6886    dataTypes = s.dataTypes,
6887    responseFields = s.responseFields,
6888    ct,
6889    type,
6890    finalDataType,
6891    firstDataType;
6892
6893  // Fill responseXXX fields
6894  for( type in responseFields ) {
6895    if ( type in responses ) {
6896      jqXHR[ responseFields[type] ] = responses[ type ];
6897    }
6898  }
6899
6900  // Remove auto dataType and get content-type in the process
6901  while( dataTypes[ 0 ] === "*" ) {
6902    dataTypes.shift();
6903    if ( ct === undefined ) {
6904      ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
6905    }
6906  }
6907
6908  // Check if we're dealing with a known content-type
6909  if ( ct ) {
6910    for ( type in contents ) {
6911      if ( contents[ type ] && contents[ type ].test( ct ) ) {
6912        dataTypes.unshift( type );
6913        break;
6914      }
6915    }
6916  }
6917
6918  // Check to see if we have a response for the expected dataType
6919  if ( dataTypes[ 0 ] in responses ) {
6920    finalDataType = dataTypes[ 0 ];
6921  } else {
6922    // Try convertible dataTypes
6923    for ( type in responses ) {
6924      if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
6925        finalDataType = type;
6926        break;
6927      }
6928      if ( !firstDataType ) {
6929        firstDataType = type;
6930      }
6931    }
6932    // Or just use first one
6933    finalDataType = finalDataType || firstDataType;
6934  }
6935
6936  // If we found a dataType
6937  // We add the dataType to the list if needed
6938  // and return the corresponding response
6939  if ( finalDataType ) {
6940    if ( finalDataType !== dataTypes[ 0 ] ) {
6941      dataTypes.unshift( finalDataType );
6942    }
6943    return responses[ finalDataType ];
6944  }
6945}
6946
6947// Chain conversions given the request and the original response
6948function ajaxConvert( s, response ) {
6949
6950  // Apply the dataFilter if provided
6951  if ( s.dataFilter ) {
6952    response = s.dataFilter( response, s.dataType );
6953  }
6954
6955  var dataTypes = s.dataTypes,
6956    converters = {},
6957    i,
6958    key,
6959    length = dataTypes.length,
6960    tmp,
6961    // Current and previous dataTypes
6962    current = dataTypes[ 0 ],
6963    prev,
6964    // Conversion expression
6965    conversion,
6966    // Conversion function
6967    conv,
6968    // Conversion functions (transitive conversion)
6969    conv1,
6970    conv2;
6971
6972  // For each dataType in the chain
6973  for( i = 1; i < length; i++ ) {
6974
6975    // Create converters map
6976    // with lowercased keys
6977    if ( i === 1 ) {
6978      for( key in s.converters ) {
6979        if( typeof key === "string" ) {
6980          converters[ key.toLowerCase() ] = s.converters[ key ];
6981        }
6982      }
6983    }
6984
6985    // Get the dataTypes
6986    prev = current;
6987    current = dataTypes[ i ];
6988
6989    // If current is auto dataType, update it to prev
6990    if( current === "*" ) {
6991      current = prev;
6992    // If no auto and dataTypes are actually different
6993    } else if ( prev !== "*" && prev !== current ) {
6994
6995      // Get the converter
6996      conversion = prev + " " + current;
6997      conv = converters[ conversion ] || converters[ "* " + current ];
6998
6999      // If there is no direct converter, search transitively
7000      if ( !conv ) {
7001        conv2 = undefined;
7002        for( conv1 in converters ) {
7003          tmp = conv1.split( " " );
7004          if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
7005            conv2 = converters[ tmp[1] + " " + current ];
7006            if ( conv2 ) {
7007              conv1 = converters[ conv1 ];
7008              if ( conv1 === true ) {
7009                conv = conv2;
7010              } else if ( conv2 === true ) {
7011                conv = conv1;
7012              }
7013              break;
7014            }
7015          }
7016        }
7017      }
7018      // If we found no converter, dispatch an error
7019      if ( !( conv || conv2 ) ) {
7020        jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
7021      }
7022      // If found converter is not an equivalence
7023      if ( conv !== true ) {
7024        // Convert with 1 or 2 converters accordingly
7025        response = conv ? conv( response ) : conv2( conv1(response) );
7026      }
7027    }
7028  }
7029  return response;
7030}
7031
7032
7033
7034
7035var jsc = jQuery.now(),
7036  jsre = /(\=)\?(&|$)|()\?\?()/i;
7037
7038// Default jsonp settings
7039jQuery.ajaxSetup({
7040  jsonp: "callback",
7041  jsonpCallback: function() {
7042    return jQuery.expando + "_" + ( jsc++ );
7043  }
7044});
7045
7046// Detect, normalize options and install callbacks for jsonp requests
7047jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7048
7049  var dataIsString = ( typeof s.data === "string" );
7050
7051  if ( s.dataTypes[ 0 ] === "jsonp" ||
7052    originalSettings.jsonpCallback ||
7053    originalSettings.jsonp != null ||
7054    s.jsonp !== false && ( jsre.test( s.url ) ||
7055        dataIsString && jsre.test( s.data ) ) ) {
7056
7057    var responseContainer,
7058      jsonpCallback = s.jsonpCallback =
7059        jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
7060      previous = window[ jsonpCallback ],
7061      url = s.url,
7062      data = s.data,
7063      replace = "$1" + jsonpCallback + "$2",
7064      cleanUp = function() {
7065        // Set callback back to previous value
7066        window[ jsonpCallback ] = previous;
7067        // Call if it was a function and we have a response
7068        if ( responseContainer && jQuery.isFunction( previous ) ) {
7069          window[ jsonpCallback ]( responseContainer[ 0 ] );
7070        }
7071      };
7072
7073    if ( s.jsonp !== false ) {
7074      url = url.replace( jsre, replace );
7075      if ( s.url === url ) {
7076        if ( dataIsString ) {
7077          data = data.replace( jsre, replace );
7078        }
7079        if ( s.data === data ) {
7080          // Add callback manually
7081          url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
7082        }
7083      }
7084    }
7085
7086    s.url = url;
7087    s.data = data;
7088
7089    // Install callback
7090    window[ jsonpCallback ] = function( response ) {
7091      responseContainer = [ response ];
7092    };
7093
7094    // Install cleanUp function
7095    jqXHR.then( cleanUp, cleanUp );
7096
7097    // Use data converter to retrieve json after script execution
7098    s.converters["script json"] = function() {
7099      if ( !responseContainer ) {
7100        jQuery.error( jsonpCallback + " was not called" );
7101      }
7102      return responseContainer[ 0 ];
7103    };
7104
7105    // force json dataType
7106    s.dataTypes[ 0 ] = "json";
7107
7108    // Delegate to script
7109    return "script";
7110  }
7111} );
7112
7113
7114
7115
7116// Install script dataType
7117jQuery.ajaxSetup({
7118  accepts: {
7119    script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
7120  },
7121  contents: {
7122    script: /javascript|ecmascript/
7123  },
7124  converters: {
7125    "text script": function( text ) {
7126      jQuery.globalEval( text );
7127      return text;
7128    }
7129  }
7130});
7131
7132// Handle cache's special case and global
7133jQuery.ajaxPrefilter( "script", function( s ) {
7134  if ( s.cache === undefined ) {
7135    s.cache = false;
7136  }
7137  if ( s.crossDomain ) {
7138    s.type = "GET";
7139    s.global = false;
7140  }
7141} );
7142
7143// Bind script tag hack transport
7144jQuery.ajaxTransport( "script", function(s) {
7145
7146  // This transport only deals with cross domain requests
7147  if ( s.crossDomain ) {
7148
7149    var script,
7150      head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
7151
7152    return {
7153
7154      send: function( _, callback ) {
7155
7156        script = document.createElement( "script" );
7157
7158        script.async = "async";
7159
7160        if ( s.scriptCharset ) {
7161          script.charset = s.scriptCharset;
7162        }
7163
7164        script.src = s.url;
7165
7166        // Attach handlers for all browsers
7167        script.onload = script.onreadystatechange = function( _, isAbort ) {
7168
7169          if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {
7170
7171            // Handle memory leak in IE
7172            script.onload = script.onreadystatechange = null;
7173
7174            // Remove the script
7175            if ( head && script.parentNode ) {
7176              head.removeChild( script );
7177            }
7178
7179            // Dereference the script
7180            script = undefined;
7181
7182            // Callback if not abort
7183            if ( !isAbort ) {
7184              callback( 200, "success" );
7185            }
7186          }
7187        };
7188        // Use insertBefore instead of appendChild  to circumvent an IE6 bug.
7189        // This arises when a base node is used (#2709 and #4378).
7190        head.insertBefore( script, head.firstChild );
7191      },
7192
7193      abort: function() {
7194        if ( script ) {
7195          script.onload( 0, 1 );
7196        }
7197      }
7198    };
7199  }
7200} );
7201
7202
7203
7204
7205var // #5280: next active xhr id and list of active xhrs' callbacks
7206  xhrId = jQuery.now(),
7207  xhrCallbacks,
7208
7209  // XHR used to determine supports properties
7210  testXHR;
7211
7212// #5280: Internet Explorer will keep connections alive if we don't abort on unload
7213function xhrOnUnloadAbort() {
7214  jQuery( window ).unload(function() {
7215    // Abort all pending requests
7216    for ( var key in xhrCallbacks ) {
7217      xhrCallbacks[ key ]( 0, 1 );
7218    }
7219  });
7220}
7221
7222// Functions to create xhrs
7223function createStandardXHR() {
7224  try {
7225    return new window.XMLHttpRequest();
7226  } catch( e ) {}
7227}
7228
7229function createActiveXHR() {
7230  try {
7231    return new window.ActiveXObject( "Microsoft.XMLHTTP" );
7232  } catch( e ) {}
7233}
7234
7235// Create the request object
7236// (This is still attached to ajaxSettings for backward compatibility)
7237jQuery.ajaxSettings.xhr = window.ActiveXObject ?
7238  /* Microsoft failed to properly
7239   * implement the XMLHttpRequest in IE7 (can't request local files),
7240   * so we use the ActiveXObject when it is available
7241   * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
7242   * we need a fallback.
7243   */
7244  function() {
7245    return !this.isLocal && createStandardXHR() || createActiveXHR();
7246  } :
7247  // For all other browsers, use the standard XMLHttpRequest object
7248  createStandardXHR;
7249
7250// Test if we can create an xhr object
7251testXHR = jQuery.ajaxSettings.xhr();
7252jQuery.support.ajax = !!testXHR;
7253
7254// Does this browser support crossDomain XHR requests
7255jQuery.support.cors = testXHR && ( "withCredentials" in testXHR );
7256
7257// No need for the temporary xhr anymore
7258testXHR = undefined;
7259
7260// Create transport if the browser can provide an xhr
7261if ( jQuery.support.ajax ) {
7262
7263  jQuery.ajaxTransport(function( s ) {
7264    // Cross domain only allowed if supported through XMLHttpRequest
7265    if ( !s.crossDomain || jQuery.support.cors ) {
7266
7267      var callback;
7268
7269      return {
7270        send: function( headers, complete ) {
7271
7272          // Get a new xhr
7273          var xhr = s.xhr(),
7274            handle,
7275            i;
7276
7277          // Open the socket
7278          // Passing null username, generates a login popup on Opera (#2865)
7279          if ( s.username ) {
7280            xhr.open( s.type, s.url, s.async, s.username, s.password );
7281          } else {
7282            xhr.open( s.type, s.url, s.async );
7283          }
7284
7285          // Apply custom fields if provided
7286          if ( s.xhrFields ) {
7287            for ( i in s.xhrFields ) {
7288              xhr[ i ] = s.xhrFields[ i ];
7289            }
7290          }
7291
7292          // Override mime type if needed
7293          if ( s.mimeType && xhr.overrideMimeType ) {
7294            xhr.overrideMimeType( s.mimeType );
7295          }
7296
7297          // Requested-With header
7298          // Not set for crossDomain requests with no content
7299          // (see why at http://trac.dojotoolkit.org/ticket/9486)
7300          // Won't change header if already provided
7301          if ( !( s.crossDomain && !s.hasContent ) && !headers["X-Requested-With"] ) {
7302            headers[ "X-Requested-With" ] = "XMLHttpRequest";
7303          }
7304
7305          // Need an extra try/catch for cross domain requests in Firefox 3
7306          try {
7307            for ( i in headers ) {
7308              xhr.setRequestHeader( i, headers[ i ] );
7309            }
7310          } catch( _ ) {}
7311
7312          // Do send the request
7313          // This may raise an exception which is actually
7314          // handled in jQuery.ajax (so no try/catch here)
7315          xhr.send( ( s.hasContent && s.data ) || null );
7316
7317          // Listener
7318          callback = function( _, isAbort ) {
7319
7320            var status,
7321              statusText,
7322              responseHeaders,
7323              responses,
7324              xml;
7325
7326            // Firefox throws exceptions when accessing properties
7327            // of an xhr when a network error occured
7328            // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
7329            try {
7330
7331              // Was never called and is aborted or complete
7332              if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
7333
7334                // Only called once
7335                callback = undefined;
7336
7337                // Do not keep as active anymore
7338                if ( handle ) {
7339                  xhr.onreadystatechange = jQuery.noop;
7340                  delete xhrCallbacks[ handle ];
7341                }
7342
7343                // If it's an abort
7344                if ( isAbort ) {
7345                  // Abort it manually if needed
7346                  if ( xhr.readyState !== 4 ) {
7347                    xhr.abort();
7348                  }
7349                } else {
7350                  status = xhr.status;
7351                  responseHeaders = xhr.getAllResponseHeaders();
7352                  responses = {};
7353                  xml = xhr.responseXML;
7354
7355                  // Construct response list
7356                  if ( xml && xml.documentElement /* #4958 */ ) {
7357                    responses.xml = xml;
7358                  }
7359                  responses.text = xhr.responseText;
7360
7361                  // Firefox throws an exception when accessing
7362                  // statusText for faulty cross-domain requests
7363                  try {
7364                    statusText = xhr.statusText;
7365                  } catch( e ) {
7366                    // We normalize with Webkit giving an empty statusText
7367                    statusText = "";
7368                  }
7369
7370                  // Filter status for non standard behaviors
7371
7372                  // If the request is local and we have data: assume a success
7373                  // (success with no data won't get notified, that's the best we
7374                  // can do given current implementations)
7375                  if ( !status && s.isLocal && !s.crossDomain ) {
7376                    status = responses.text ? 200 : 404;
7377                  // IE - #1450: sometimes returns 1223 when it should be 204
7378                  } else if ( status === 1223 ) {
7379                    status = 204;
7380                  }
7381                }
7382              }
7383            } catch( firefoxAccessException ) {
7384              if ( !isAbort ) {
7385                complete( -1, firefoxAccessException );
7386              }
7387            }
7388
7389            // Call complete if needed
7390            if ( responses ) {
7391              complete( status, statusText, responses, responseHeaders );
7392            }
7393          };
7394
7395          // if we're in sync mode or it's in cache
7396          // and has been retrieved directly (IE6 & IE7)
7397          // we need to manually fire the callback
7398          if ( !s.async || xhr.readyState === 4 ) {
7399            callback();
7400          } else {
7401            // Create the active xhrs callbacks list if needed
7402            // and attach the unload handler
7403            if ( !xhrCallbacks ) {
7404              xhrCallbacks = {};
7405              xhrOnUnloadAbort();
7406            }
7407            // Add to list of active xhrs callbacks
7408            handle = xhrId++;
7409            xhr.onreadystatechange = xhrCallbacks[ handle ] = callback;
7410          }
7411        },
7412
7413        abort: function() {
7414          if ( callback ) {
7415            callback(0,1);
7416          }
7417        }
7418      };
7419    }
7420  });
7421}
7422
7423
7424
7425
7426var elemdisplay = {},
7427  rfxtypes = /^(?:toggle|show|hide)$/,
7428  rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
7429  timerId,
7430  fxAttrs = [
7431    // height animations
7432    [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
7433    // width animations
7434    [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
7435    // opacity animations
7436    [ "opacity" ]
7437  ];
7438
7439jQuery.fn.extend({
7440  show: function( speed, easing, callback ) {
7441    var elem, display;
7442
7443    if ( speed || speed === 0 ) {
7444      return this.animate( genFx("show", 3), speed, easing, callback);
7445
7446    } else {
7447      for ( var i = 0, j = this.length; i < j; i++ ) {
7448        elem = this[i];
7449        display = elem.style.display;
7450
7451        // Reset the inline display of this element to learn if it is
7452        // being hidden by cascaded rules or not
7453        if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
7454          display = elem.style.display = "";
7455        }
7456
7457        // Set elements which have been overridden with display: none
7458        // in a stylesheet to whatever the default browser style is
7459        // for such an element
7460        if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
7461          jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
7462        }
7463      }
7464
7465      // Set the display of most of the elements in a second loop
7466      // to avoid the constant reflow
7467      for ( i = 0; i < j; i++ ) {
7468        elem = this[i];
7469        display = elem.style.display;
7470
7471        if ( display === "" || display === "none" ) {
7472          elem.style.display = jQuery._data(elem, "olddisplay") || "";
7473        }
7474      }
7475
7476      return this;
7477    }
7478  },
7479
7480  hide: function( speed, easing, callback ) {
7481    if ( speed || speed === 0 ) {
7482      return this.animate( genFx("hide", 3), speed, easing, callback);
7483
7484    } else {
7485      for ( var i = 0, j = this.length; i < j; i++ ) {
7486        var display = jQuery.css( this[i], "display" );
7487
7488        if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
7489          jQuery._data( this[i], "olddisplay", display );
7490        }
7491      }
7492
7493      // Set the display of the elements in a second loop
7494      // to avoid the constant reflow
7495      for ( i = 0; i < j; i++ ) {
7496        this[i].style.display = "none";
7497      }
7498
7499      return this;
7500    }
7501  },
7502
7503  // Save the old toggle function
7504  _toggle: jQuery.fn.toggle,
7505
7506  toggle: function( fn, fn2, callback ) {
7507    var bool = typeof fn === "boolean";
7508
7509    if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
7510      this._toggle.apply( this, arguments );
7511
7512    } else if ( fn == null || bool ) {
7513      this.each(function() {
7514        var state = bool ? fn : jQuery(this).is(":hidden");
7515        jQuery(this)[ state ? "show" : "hide" ]();
7516      });
7517
7518    } else {
7519      this.animate(genFx("toggle", 3), fn, fn2, callback);
7520    }
7521
7522    return this;
7523  },
7524
7525  fadeTo: function( speed, to, easing, callback ) {
7526    return this.filter(":hidden").css("opacity", 0).show().end()
7527          .animate({opacity: to}, speed, easing, callback);
7528  },
7529
7530  animate: function( prop, speed, easing, callback ) {
7531    var optall = jQuery.speed(speed, easing, callback);
7532
7533    if ( jQuery.isEmptyObject( prop ) ) {
7534      return this.each( optall.complete );
7535    }
7536
7537    return this[ optall.queue === false ? "each" : "queue" ](function() {
7538      // XXX 'this' does not always have a nodeName when running the
7539      // test suite
7540
7541      var opt = jQuery.extend({}, optall), p,
7542        isElement = this.nodeType === 1,
7543        hidden = isElement && jQuery(this).is(":hidden"),
7544        self = this;
7545
7546      for ( p in prop ) {
7547        var name = jQuery.camelCase( p );
7548
7549        if ( p !== name ) {
7550          prop[ name ] = prop[ p ];
7551          delete prop[ p ];
7552          p = name;
7553        }
7554
7555        if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
7556          return opt.complete.call(this);
7557        }
7558
7559        if ( isElement && ( p === "height" || p === "width" ) ) {
7560          // Make sure that nothing sneaks out
7561          // Record all 3 overflow attributes because IE does not
7562          // change the overflow attribute when overflowX and
7563          // overflowY are set to the same value
7564          opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
7565
7566          // Set display property to inline-block for height/width
7567          // animations on inline elements that are having width/height
7568          // animated
7569          if ( jQuery.css( this, "display" ) === "inline" &&
7570              jQuery.css( this, "float" ) === "none" ) {
7571            if ( !jQuery.support.inlineBlockNeedsLayout ) {
7572              this.style.display = "inline-block";
7573
7574            } else {
7575              var display = defaultDisplay(this.nodeName);
7576
7577              // inline-level elements accept inline-block;
7578              // block-level elements need to be inline with layout
7579              if ( display === "inline" ) {
7580                this.style.display = "inline-block";
7581
7582              } else {
7583                this.style.display = "inline";
7584                this.style.zoom = 1;
7585              }
7586            }
7587          }
7588        }
7589
7590        if ( jQuery.isArray( prop[p] ) ) {
7591          // Create (if needed) and add to specialEasing
7592          (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
7593          prop[p] = prop[p][0];
7594        }
7595      }
7596
7597      if ( opt.overflow != null ) {
7598        this.style.overflow = "hidden";
7599      }
7600
7601      opt.curAnim = jQuery.extend({}, prop);
7602
7603      jQuery.each( prop, function( name, val ) {
7604        var e = new jQuery.fx( self, opt, name );
7605
7606        if ( rfxtypes.test(val) ) {
7607          e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
7608
7609        } else {
7610          var parts = rfxnum.exec(val),
7611            start = e.cur();
7612
7613          if ( parts ) {
7614            var end = parseFloat( parts[2] ),
7615              unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" );
7616
7617            // We need to compute starting value
7618            if ( unit !== "px" ) {
7619              jQuery.style( self, name, (end || 1) + unit);
7620              start = ((end || 1) / e.cur()) * start;
7621              jQuery.style( self, name, start + unit);
7622            }
7623
7624            // If a +=/-= token was provided, we're doing a relative animation
7625            if ( parts[1] ) {
7626              end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
7627            }
7628
7629            e.custom( start, end, unit );
7630
7631          } else {
7632            e.custom( start, val, "" );
7633          }
7634        }
7635      });
7636
7637      // For JS strict compliance
7638      return true;
7639    });
7640  },
7641
7642  stop: function( clearQueue, gotoEnd ) {
7643    var timers = jQuery.timers;
7644
7645    if ( clearQueue ) {
7646      this.queue([]);
7647    }
7648
7649    this.each(function() {
7650      // go in reverse order so anything added to the queue during the loop is ignored
7651      for ( var i = timers.length - 1; i >= 0; i-- ) {
7652        if ( timers[i].elem === this ) {
7653          if (gotoEnd) {
7654            // force the next step to be the last
7655            timers[i](true);
7656          }
7657
7658          timers.splice(i, 1);
7659        }
7660      }
7661    });
7662
7663    // start the next in the queue if the last step wasn't forced
7664    if ( !gotoEnd ) {
7665      this.dequeue();
7666    }
7667
7668    return this;
7669  }
7670
7671});
7672
7673function genFx( type, num ) {
7674  var obj = {};
7675
7676  jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
7677    obj[ this ] = type;
7678  });
7679
7680  return obj;
7681}
7682
7683// Generate shortcuts for custom animations
7684jQuery.each({
7685  slideDown: genFx("show", 1),
7686  slideUp: genFx("hide", 1),
7687  slideToggle: genFx("toggle", 1),
7688  fadeIn: { opacity: "show" },
7689  fadeOut: { opacity: "hide" },
7690  fadeToggle: { opacity: "toggle" }
7691}, function( name, props ) {
7692  jQuery.fn[ name ] = function( speed, easing, callback ) {
7693    return this.animate( props, speed, easing, callback );
7694  };
7695});
7696
7697jQuery.extend({
7698  speed: function( speed, easing, fn ) {
7699    var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
7700      complete: fn || !fn && easing ||
7701        jQuery.isFunction( speed ) && speed,
7702      duration: speed,
7703      easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
7704    };
7705
7706    opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
7707      opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
7708
7709    // Queueing
7710    opt.old = opt.complete;
7711    opt.complete = function() {
7712      if ( opt.queue !== false ) {
7713        jQuery(this).dequeue();
7714      }
7715      if ( jQuery.isFunction( opt.old ) ) {
7716        opt.old.call( this );
7717      }
7718    };
7719
7720    return opt;
7721  },
7722
7723  easing: {
7724    linear: function( p, n, firstNum, diff ) {
7725      return firstNum + diff * p;
7726    },
7727    swing: function( p, n, firstNum, diff ) {
7728      return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
7729    }
7730  },
7731
7732  timers: [],
7733
7734  fx: function( elem, options, prop ) {
7735    this.options = options;
7736    this.elem = elem;
7737    this.prop = prop;
7738
7739    if ( !options.orig ) {
7740      options.orig = {};
7741    }
7742  }
7743
7744});
7745
7746jQuery.fx.prototype = {
7747  // Simple function for setting a style value
7748  update: function() {
7749    if ( this.options.step ) {
7750      this.options.step.call( this.elem, this.now, this );
7751    }
7752
7753    (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
7754  },
7755
7756  // Get the current size
7757  cur: function() {
7758    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
7759      return this.elem[ this.prop ];
7760    }
7761
7762    var parsed,
7763      r = jQuery.css( this.elem, this.prop );
7764    // Empty strings, null, undefined and "auto" are converted to 0,
7765    // complex values such as "rotate(1rad)" are returned as is,
7766    // simple values such as "10px" are parsed to Float.
7767    return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
7768  },
7769
7770  // Start an animation from one number to another
7771  custom: function( from, to, unit ) {
7772    var self = this,
7773      fx = jQuery.fx;
7774
7775    this.startTime = jQuery.now();
7776    this.start = from;
7777    this.end = to;
7778    this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
7779    this.now = this.start;
7780    this.pos = this.state = 0;
7781
7782    function t( gotoEnd ) {
7783      return self.step(gotoEnd);
7784    }
7785
7786    t.elem = this.elem;
7787
7788    if ( t() && jQuery.timers.push(t) && !timerId ) {
7789      timerId = setInterval(fx.tick, fx.interval);
7790    }
7791  },
7792
7793  // Simple 'show' function
7794  show: function() {
7795    // Remember where we started, so that we can go back to it later
7796    this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
7797    this.options.show = true;
7798
7799    // Begin the animation
7800    // Make sure that we start at a small width/height to avoid any
7801    // flash of content
7802    this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
7803
7804    // Start by showing the element
7805    jQuery( this.elem ).show();
7806  },
7807
7808  // Simple 'hide' function
7809  hide: function() {
7810    // Remember where we started, so that we can go back to it later
7811    this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
7812    this.options.hide = true;
7813
7814    // Begin the animation
7815    this.custom(this.cur(), 0);
7816  },
7817
7818  // Each step of an animation
7819  step: function( gotoEnd ) {
7820    var t = jQuery.now(), done = true;
7821
7822    if ( gotoEnd || t >= this.options.duration + this.startTime ) {
7823      this.now = this.end;
7824      this.pos = this.state = 1;
7825      this.update();
7826
7827      this.options.curAnim[ this.prop ] = true;
7828
7829      for ( var i in this.options.curAnim ) {
7830        if ( this.options.curAnim[i] !== true ) {
7831          done = false;
7832        }
7833      }
7834
7835      if ( done ) {
7836        // Reset the overflow
7837        if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
7838          var elem = this.elem,
7839            options = this.options;
7840
7841          jQuery.each( [ "", "X", "Y" ], function (index, value) {
7842            elem.style[ "overflow" + value ] = options.overflow[index];
7843          } );
7844        }
7845
7846        // Hide the element if the "hide" operation was done
7847        if ( this.options.hide ) {
7848          jQuery(this.elem).hide();
7849        }
7850
7851        // Reset the properties, if the item has been hidden or shown
7852        if ( this.options.hide || this.options.show ) {
7853          for ( var p in this.options.curAnim ) {
7854            jQuery.style( this.elem, p, this.options.orig[p] );
7855          }
7856        }
7857
7858        // Execute the complete function
7859        this.options.complete.call( this.elem );
7860      }
7861
7862      return false;
7863
7864    } else {
7865      var n = t - this.startTime;
7866      this.state = n / this.options.duration;
7867
7868      // Perform the easing function, defaults to swing
7869      var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
7870      var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
7871      this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
7872      this.now = this.start + ((this.end - this.start) * this.pos);
7873
7874      // Perform the next step of the animation
7875      this.update();
7876    }
7877
7878    return true;
7879  }
7880};
7881
7882jQuery.extend( jQuery.fx, {
7883  tick: function() {
7884    var timers = jQuery.timers;
7885
7886    for ( var i = 0; i < timers.length; i++ ) {
7887      if ( !timers[i]() ) {
7888        timers.splice(i--, 1);
7889      }
7890    }
7891
7892    if ( !timers.length ) {
7893      jQuery.fx.stop();
7894    }
7895  },
7896
7897  interval: 13,
7898
7899  stop: function() {
7900    clearInterval( timerId );
7901    timerId = null;
7902  },
7903
7904  speeds: {
7905    slow: 600,
7906    fast: 200,
7907    // Default speed
7908    _default: 400
7909  },
7910
7911  step: {
7912    opacity: function( fx ) {
7913      jQuery.style( fx.elem, "opacity", fx.now );
7914    },
7915
7916    _default: function( fx ) {
7917      if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
7918        fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
7919      } else {
7920        fx.elem[ fx.prop ] = fx.now;
7921      }
7922    }
7923  }
7924});
7925
7926if ( jQuery.expr && jQuery.expr.filters ) {
7927  jQuery.expr.filters.animated = function( elem ) {
7928    return jQuery.grep(jQuery.timers, function( fn ) {
7929      return elem === fn.elem;
7930    }).length;
7931  };
7932}
7933
7934function defaultDisplay( nodeName ) {
7935  if ( !elemdisplay[ nodeName ] ) {
7936    var elem = jQuery("<" + nodeName + ">").appendTo("body"),
7937      display = elem.css("display");
7938
7939    elem.remove();
7940
7941    if ( display === "none" || display === "" ) {
7942      display = "block";
7943    }
7944
7945    elemdisplay[ nodeName ] = display;
7946  }
7947
7948  return elemdisplay[ nodeName ];
7949}
7950
7951
7952
7953
7954var rtable = /^t(?:able|d|h)$/i,
7955  rroot = /^(?:body|html)$/i;
7956
7957if ( "getBoundingClientRect" in document.documentElement ) {
7958  jQuery.fn.offset = function( options ) {
7959    var elem = this[0], box;
7960
7961    if ( options ) {
7962      return this.each(function( i ) {
7963        jQuery.offset.setOffset( this, options, i );
7964      });
7965    }
7966
7967    if ( !elem || !elem.ownerDocument ) {
7968      return null;
7969    }
7970
7971    if ( elem === elem.ownerDocument.body ) {
7972      return jQuery.offset.bodyOffset( elem );
7973    }
7974
7975    try {
7976      box = elem.getBoundingClientRect();
7977    } catch(e) {}
7978
7979    var doc = elem.ownerDocument,
7980      docElem = doc.documentElement;
7981
7982    // Make sure we're not dealing with a disconnected DOM node
7983    if ( !box || !jQuery.contains( docElem, elem ) ) {
7984      return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
7985    }
7986
7987    var body = doc.body,
7988      win = getWindow(doc),
7989      clientTop  = docElem.clientTop  || body.clientTop  || 0,
7990      clientLeft = docElem.clientLeft || body.clientLeft || 0,
7991      scrollTop  = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop  || body.scrollTop ),
7992      scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
7993      top  = box.top  + scrollTop  - clientTop,
7994      left = box.left + scrollLeft - clientLeft;
7995
7996    return { top: top, left: left };
7997  };
7998
7999} else {
8000  jQuery.fn.offset = function( options ) {
8001    var elem = this[0];
8002
8003    if ( options ) {
8004      return this.each(function( i ) {
8005        jQuery.offset.setOffset( this, options, i );
8006      });
8007    }
8008
8009    if ( !elem || !elem.ownerDocument ) {
8010      return null;
8011    }
8012
8013    if ( elem === elem.ownerDocument.body ) {
8014      return jQuery.offset.bodyOffset( elem );
8015    }
8016
8017    jQuery.offset.initialize();
8018
8019    var computedStyle,
8020      offsetParent = elem.offsetParent,
8021      prevOffsetParent = elem,
8022      doc = elem.ownerDocument,
8023      docElem = doc.documentElement,
8024      body = doc.body,
8025      defaultView = doc.defaultView,
8026      prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
8027      top = elem.offsetTop,
8028      left = elem.offsetLeft;
8029
8030    while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
8031      if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
8032        break;
8033      }
8034
8035      computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
8036      top  -= elem.scrollTop;
8037      left -= elem.scrollLeft;
8038
8039      if ( elem === offsetParent ) {
8040        top  += elem.offsetTop;
8041        left += elem.offsetLeft;
8042
8043        if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
8044          top  += parseFloat( computedStyle.borderTopWidth  ) || 0;
8045          left += parseFloat( computedStyle.borderLeftWidth ) || 0;
8046        }
8047
8048        prevOffsetParent = offsetParent;
8049        offsetParent = elem.offsetParent;
8050      }
8051
8052      if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
8053        top  += parseFloat( computedStyle.borderTopWidth  ) || 0;
8054        left += parseFloat( computedStyle.borderLeftWidth ) || 0;
8055      }
8056
8057      prevComputedStyle = computedStyle;
8058    }
8059
8060    if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
8061      top  += body.offsetTop;
8062      left += body.offsetLeft;
8063    }
8064
8065    if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
8066      top  += Math.max( docElem.scrollTop, body.scrollTop );
8067      left += Math.max( docElem.scrollLeft, body.scrollLeft );
8068    }
8069
8070    return { top: top, left: left };
8071  };
8072}
8073
8074jQuery.offset = {
8075  initialize: function() {
8076    var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
8077      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>";
8078
8079    jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
8080
8081    container.innerHTML = html;
8082    body.insertBefore( container, body.firstChild );
8083    innerDiv = container.firstChild;
8084    checkDiv = innerDiv.firstChild;
8085    td = innerDiv.nextSibling.firstChild.firstChild;
8086
8087    this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
8088    this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
8089
8090    checkDiv.style.position = "fixed";
8091    checkDiv.style.top = "20px";
8092
8093    // safari subtracts parent border width here which is 5px
8094    this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
8095    checkDiv.style.position = checkDiv.style.top = "";
8096
8097    innerDiv.style.overflow = "hidden";
8098    innerDiv.style.position = "relative";
8099
8100    this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
8101
8102    this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
8103
8104    body.removeChild( container );
8105    body = container = innerDiv = checkDiv = table = td = null;
8106    jQuery.offset.initialize = jQuery.noop;
8107  },
8108
8109  bodyOffset: function( body ) {
8110    var top = body.offsetTop,
8111      left = body.offsetLeft;
8112
8113    jQuery.offset.initialize();
8114
8115    if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
8116      top  += parseFloat( jQuery.css(body, "marginTop") ) || 0;
8117      left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
8118    }
8119
8120    return { top: top, left: left };
8121  },
8122
8123  setOffset: function( elem, options, i ) {
8124    var position = jQuery.css( elem, "position" );
8125
8126    // set position first, in-case top/left are set even on static elem
8127    if ( position === "static" ) {
8128      elem.style.position = "relative";
8129    }
8130
8131    var curElem = jQuery( elem ),
8132      curOffset = curElem.offset(),
8133      curCSSTop = jQuery.css( elem, "top" ),
8134      curCSSLeft = jQuery.css( elem, "left" ),
8135      calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
8136      props = {}, curPosition = {}, curTop, curLeft;
8137
8138    // need to be able to calculate position if either top or left is auto and position is absolute
8139    if ( calculatePosition ) {
8140      curPosition = curElem.position();
8141    }
8142
8143    curTop  = calculatePosition ? curPosition.top  : parseInt( curCSSTop,  10 ) || 0;
8144    curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
8145
8146    if ( jQuery.isFunction( options ) ) {
8147      options = options.call( elem, i, curOffset );
8148    }
8149
8150    if (options.top != null) {
8151      props.top = (options.top - curOffset.top) + curTop;
8152    }
8153    if (options.left != null) {
8154      props.left = (options.left - curOffset.left) + curLeft;
8155    }
8156
8157    if ( "using" in options ) {
8158      options.using.call( elem, props );
8159    } else {
8160      curElem.css( props );
8161    }
8162  }
8163};
8164
8165
8166jQuery.fn.extend({
8167  position: function() {
8168    if ( !this[0] ) {
8169      return null;
8170    }
8171
8172    var elem = this[0],
8173
8174    // Get *real* offsetParent
8175    offsetParent = this.offsetParent(),
8176
8177    // Get correct offsets
8178    offset       = this.offset(),
8179    parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
8180
8181    // Subtract element margins
8182    // note: when an element has margin: auto the offsetLeft and marginLeft
8183    // are the same in Safari causing offset.left to incorrectly be 0
8184    offset.top  -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
8185    offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
8186
8187    // Add offsetParent borders
8188    parentOffset.top  += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
8189    parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
8190
8191    // Subtract the two offsets
8192    return {
8193      top:  offset.top  - parentOffset.top,
8194      left: offset.left - parentOffset.left
8195    };
8196  },
8197
8198  offsetParent: function() {
8199    return this.map(function() {
8200      var offsetParent = this.offsetParent || document.body;
8201      while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
8202        offsetParent = offsetParent.offsetParent;
8203      }
8204      return offsetParent;
8205    });
8206  }
8207});
8208
8209
8210// Create scrollLeft and scrollTop methods
8211jQuery.each( ["Left", "Top"], function( i, name ) {
8212  var method = "scroll" + name;
8213
8214  jQuery.fn[ method ] = function(val) {
8215    var elem = this[0], win;
8216
8217    if ( !elem ) {
8218      return null;
8219    }
8220
8221    if ( val !== undefined ) {
8222      // Set the scroll offset
8223      return this.each(function() {
8224        win = getWindow( this );
8225
8226        if ( win ) {
8227          win.scrollTo(
8228            !i ? val : jQuery(win).scrollLeft(),
8229            i ? val : jQuery(win).scrollTop()
8230          );
8231
8232        } else {
8233          this[ method ] = val;
8234        }
8235      });
8236    } else {
8237      win = getWindow( elem );
8238
8239      // Return the scroll offset
8240      return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
8241        jQuery.support.boxModel && win.document.documentElement[ method ] ||
8242          win.document.body[ method ] :
8243        elem[ method ];
8244    }
8245  };
8246});
8247
8248function getWindow( elem ) {
8249  return jQuery.isWindow( elem ) ?
8250    elem :
8251    elem.nodeType === 9 ?
8252      elem.defaultView || elem.parentWindow :
8253      false;
8254}
8255
8256
8257
8258
8259// Create innerHeight, innerWidth, outerHeight and outerWidth methods
8260jQuery.each([ "Height", "Width" ], function( i, name ) {
8261
8262  var type = name.toLowerCase();
8263
8264  // innerHeight and innerWidth
8265  jQuery.fn["inner" + name] = function() {
8266    return this[0] ?
8267      parseFloat( jQuery.css( this[0], type, "padding" ) ) :
8268      null;
8269  };
8270
8271  // outerHeight and outerWidth
8272  jQuery.fn["outer" + name] = function( margin ) {
8273    return this[0] ?
8274      parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
8275      null;
8276  };
8277
8278  jQuery.fn[ type ] = function( size ) {
8279    // Get window width or height
8280    var elem = this[0];
8281    if ( !elem ) {
8282      return size == null ? null : this;
8283    }
8284
8285    if ( jQuery.isFunction( size ) ) {
8286      return this.each(function( i ) {
8287        var self = jQuery( this );
8288        self[ type ]( size.call( this, i, self[ type ]() ) );
8289      });
8290    }
8291
8292    if ( jQuery.isWindow( elem ) ) {
8293      // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
8294      // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
8295      var docElemProp = elem.document.documentElement[ "client" + name ];
8296      return elem.document.compatMode === "CSS1Compat" && docElemProp ||
8297        elem.document.body[ "client" + name ] || docElemProp;
8298
8299    // Get document width or height
8300    } else if ( elem.nodeType === 9 ) {
8301      // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
8302      return Math.max(
8303        elem.documentElement["client" + name],
8304        elem.body["scroll" + name], elem.documentElement["scroll" + name],
8305        elem.body["offset" + name], elem.documentElement["offset" + name]
8306      );
8307
8308    // Get or set width or height on the element
8309    } else if ( size === undefined ) {
8310      var orig = jQuery.css( elem, type ),
8311        ret = parseFloat( orig );
8312
8313      return jQuery.isNaN( ret ) ? orig : ret;
8314
8315    // Set the width or height on the element (default to pixels if value is unitless)
8316    } else {
8317      return this.css( type, typeof size === "string" ? size : size + "px" );
8318    }
8319  };
8320
8321});
8322
8323
8324window.jQuery = window.$ = jQuery;
8325})(window);
Note: See TracBrowser for help on using the repository browser.