-jQuery.fn.extend({\r
-\r
- // overwrite the old show method\r
- _show: jQuery.fn.show,\r
- \r
- /**\r
- * Show all matched elements using a graceful animation and firing an\r
- * optional callback after completion.\r
- *\r
- * The height, width, and opacity of each of the matched elements \r
- * are changed dynamically according to the specified speed.\r
- *\r
- * @example $("p").show("slow");\r
- *\r
- * @example $("p").show("slow",function(){\r
- * alert("Animation Done.");\r
- * });\r
- *\r
- * @name show\r
- * @type jQuery\r
- * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
- * @param Function callback (optional) A function to be executed whenever the animation completes.\r
- * @cat Effects\r
- * @see hide(String|Number,Function)\r
- */\r
- show: function(speed,callback){\r
- return speed ? this.animate({\r
- height: "show", width: "show", opacity: "show"\r
- }, speed, callback) : this._show();\r
- },\r
- \r
- // Overwrite the old hide method\r
- _hide: jQuery.fn.hide,\r
- \r
- /**\r
- * Hide all matched elements using a graceful animation and firing an\r
- * optional callback after completion.\r
- *\r
- * The height, width, and opacity of each of the matched elements \r
- * are changed dynamically according to the specified speed.\r
- *\r
- * @example $("p").hide("slow");\r
- *\r
- * @example $("p").hide("slow",function(){\r
- * alert("Animation Done.");\r
- * });\r
- *\r
- * @name hide\r
- * @type jQuery\r
- * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
- * @param Function callback (optional) A function to be executed whenever the animation completes.\r
- * @cat Effects\r
- * @see show(String|Number,Function)\r
- */\r
- hide: function(speed,callback){\r
- return speed ? this.animate({\r
- height: "hide", width: "hide", opacity: "hide"\r
- }, speed, callback) : this._hide();\r
- },\r
- \r
- /**\r
- * Reveal all matched elements by adjusting their height and firing an\r
- * optional callback after completion.\r
- *\r
- * Only the height is adjusted for this animation, causing all matched\r
- * elements to be revealed in a "sliding" manner.\r
- *\r
- * @example $("p").slideDown("slow");\r
- *\r
- * @example $("p").slideDown("slow",function(){\r
- * alert("Animation Done.");\r
- * });\r
- *\r
- * @name slideDown\r
- * @type jQuery\r
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
- * @param Function callback (optional) A function to be executed whenever the animation completes.\r
- * @cat Effects\r
- * @see slideUp(String|Number,Function)\r
- * @see slideToggle(String|Number,Function)\r
- */\r
- slideDown: function(speed,callback){\r
- return this.animate({height: "show"}, speed, callback);\r
- },\r
- \r
- /**\r
- * Hide all matched elements by adjusting their height and firing an\r
- * optional callback after completion.\r
- *\r
- * Only the height is adjusted for this animation, causing all matched\r
- * elements to be hidden in a "sliding" manner.\r
- *\r
- * @example $("p").slideUp("slow");\r
- *\r
- * @example $("p").slideUp("slow",function(){\r
- * alert("Animation Done.");\r
- * });\r
- *\r
- * @name slideUp\r
- * @type jQuery\r
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
- * @param Function callback (optional) A function to be executed whenever the animation completes.\r
- * @cat Effects\r
- * @see slideDown(String|Number,Function)\r
- * @see slideToggle(String|Number,Function)\r
- */\r
- slideUp: function(speed,callback){\r
- return this.animate({height: "hide"}, speed, callback);\r
- },\r
-\r
- /**\r
- * Toggle the visibility of all matched elements by adjusting their height and firing an\r
- * optional callback after completion.\r
- *\r
- * Only the height is adjusted for this animation, causing all matched\r
- * elements to be hidden in a "sliding" manner.\r
- *\r
- * @example $("p").slideToggle("slow");\r
- *\r
- * @example $("p").slideToggle("slow",function(){\r
- * alert("Animation Done.");\r
- * });\r
- *\r
- * @name slideToggle\r
- * @type jQuery\r
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
- * @param Function callback (optional) A function to be executed whenever the animation completes.\r
- * @cat Effects\r
- * @see slideDown(String|Number,Function)\r
- * @see slideUp(String|Number,Function)\r
- */\r
- slideToggle: function(speed, callback){\r
- return this.each(function(){\r
- var state = jQuery(this).is(":hidden") ? "show" : "hide";\r
- jQuery(this).animate({height: state}, speed, callback);\r
- });\r
- },\r
- \r
- /**\r
- * Fade in all matched elements by adjusting their opacity and firing an\r
- * optional callback after completion.\r
- *\r
- * Only the opacity is adjusted for this animation, meaning that\r
- * all of the matched elements should already have some form of height\r
- * and width associated with them.\r
- *\r
- * @example $("p").fadeIn("slow");\r
- *\r
- * @example $("p").fadeIn("slow",function(){\r
- * alert("Animation Done.");\r
- * });\r
- *\r
- * @name fadeIn\r
- * @type jQuery\r
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
- * @param Function callback (optional) A function to be executed whenever the animation completes.\r
- * @cat Effects\r
- * @see fadeOut(String|Number,Function)\r
- * @see fadeTo(String|Number,Number,Function)\r
- */\r
- fadeIn: function(speed, callback){\r
- return this.animate({opacity: "show"}, speed, callback);\r
- },\r
- \r
- /**\r
- * Fade out all matched elements by adjusting their opacity and firing an\r
- * optional callback after completion.\r
- *\r
- * Only the opacity is adjusted for this animation, meaning that\r
- * all of the matched elements should already have some form of height\r
- * and width associated with them.\r
- *\r
- * @example $("p").fadeOut("slow");\r
- *\r
- * @example $("p").fadeOut("slow",function(){\r
- * alert("Animation Done.");\r
- * });\r
- *\r
- * @name fadeOut\r
- * @type jQuery\r
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
- * @param Function callback (optional) A function to be executed whenever the animation completes.\r
- * @cat Effects\r
- * @see fadeIn(String|Number,Function)\r
- * @see fadeTo(String|Number,Number,Function)\r
- */\r
- fadeOut: function(speed, callback){\r
- return this.animate({opacity: "hide"}, speed, callback);\r
- },\r
- \r
- /**\r
- * Fade the opacity of all matched elements to a specified opacity and firing an\r
- * optional callback after completion.\r
- *\r
- * Only the opacity is adjusted for this animation, meaning that\r
- * all of the matched elements should already have some form of height\r
- * and width associated with them.\r
- *\r
- * @example $("p").fadeTo("slow", 0.5);\r
- *\r
- * @example $("p").fadeTo("slow", 0.5, function(){\r
- * alert("Animation Done.");\r
- * });\r
- *\r
- * @name fadeTo\r
- * @type jQuery\r
- * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
- * @param Number opacity The opacity to fade to (a number from 0 to 1).\r
- * @param Function callback (optional) A function to be executed whenever the animation completes.\r
- * @cat Effects\r
- * @see fadeIn(String|Number,Function)\r
- * @see fadeOut(String|Number,Function)\r
- */\r
- fadeTo: function(speed,to,callback){\r
- return this.animate({opacity: to}, speed, callback);\r
- },\r
- \r
- /**\r
- * A function for making your own, custom, animations. The key aspect of\r
- * this function is the object of style properties that will be animated,\r
- * and to what end. Each key within the object represents a style property\r
- * that will also be animated (for example: "height", "top", or "opacity").\r
- *\r
- * The value associated with the key represents to what end the property\r
- * will be animated. If a number is provided as the value, then the style\r
- * property will be transitioned from its current state to that new number.\r
- * Oterwise if the string "hide", "show", or "toggle" is provided, a default\r
- * animation will be constructed for that property.\r
- *\r
- * @example $("p").animate({\r
- * height: 'toggle', opacity: 'toggle'\r
- * }, "slow");\r
- *\r
- * @example $("p").animate({\r
- * left: 50, opacity: 'show'\r
+jQuery.fn.extend({
+
+ /**
+ * Displays each of the set of matched elements if they are hidden.
+ *
+ * @example $("p").show()
+ * @before <p style="display: none">Hello</p>
+ * @result [ <p style="display: block">Hello</p> ]
+ *
+ * @name show
+ * @type jQuery
+ * @cat Effects
+ */
+
+ /**
+ * Show all matched elements using a graceful animation and firing an
+ * optional callback after completion.
+ *
+ * The height, width, and opacity of each of the matched elements
+ * are changed dynamically according to the specified speed.
+ *
+ * @example $("p").show("slow");
+ *
+ * @example $("p").show("slow",function(){
+ * alert("Animation Done.");
+ * });
+ *
+ * @name show
+ * @type jQuery
+ * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
+ * @param Function callback (optional) A function to be executed whenever the animation completes.
+ * @cat Effects
+ * @see hide(String|Number,Function)
+ */
+ show: function(speed,callback){
+ var hidden = this.filter(":hidden");
+ speed ?
+ hidden.animate({
+ height: "show", width: "show", opacity: "show"
+ }, speed, callback) :
+
+ hidden.each(function(){
+ this.style.display = this.oldblock ? this.oldblock : "";
+ if ( jQuery.css(this,"display") == "none" )
+ this.style.display = "block";
+ });
+ return this;
+ },
+
+ /**
+ * Hides each of the set of matched elements if they are shown.
+ *
+ * @example $("p").hide()
+ * @before <p>Hello</p>
+ * @result [ <p style="display: none">Hello</p> ]
+ *
+ * @name hide
+ * @type jQuery
+ * @cat Effects
+ */
+
+ /**
+ * Hide all matched elements using a graceful animation and firing an
+ * optional callback after completion.
+ *
+ * The height, width, and opacity of each of the matched elements
+ * are changed dynamically according to the specified speed.
+ *
+ * @example $("p").hide("slow");
+ *
+ * @example $("p").hide("slow",function(){
+ * alert("Animation Done.");
+ * });
+ *
+ * @name hide
+ * @type jQuery
+ * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
+ * @param Function callback (optional) A function to be executed whenever the animation completes.
+ * @cat Effects
+ * @see show(String|Number,Function)
+ */
+ hide: function(speed,callback){
+ var visible = this.filter(":visible");
+ speed ?
+ visible.animate({
+ height: "hide", width: "hide", opacity: "hide"
+ }, speed, callback) :
+
+ visible.each(function(){
+ this.oldblock = this.oldblock || jQuery.css(this,"display");
+ if ( this.oldblock == "none" )
+ this.oldblock = "block";
+ this.style.display = "none";
+ });
+ return this;
+ },
+
+ // Save the old toggle function
+ _toggle: jQuery.fn.toggle,
+
+ /**
+ * Toggles each of the set of matched elements. If they are shown,
+ * toggle makes them hidden. If they are hidden, toggle
+ * makes them shown.
+ *
+ * @example $("p").toggle()
+ * @before <p>Hello</p><p style="display: none">Hello Again</p>
+ * @result [ <p style="display: none">Hello</p>, <p style="display: block">Hello Again</p> ]
+ *
+ * @name toggle
+ * @type jQuery
+ * @cat Effects
+ */
+ toggle: function( fn, fn2 ){
+ var args = arguments;
+ return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
+ this._toggle( fn, fn2 ) :
+ this.each(function(){
+ jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]
+ .apply( jQuery(this), args );
+ });
+ },
+
+ /**
+ * Reveal all matched elements by adjusting their height and firing an
+ * optional callback after completion.
+ *
+ * Only the height is adjusted for this animation, causing all matched
+ * elements to be revealed in a "sliding" manner.
+ *
+ * @example $("p").slideDown("slow");
+ *
+ * @example $("p").slideDown("slow",function(){
+ * alert("Animation Done.");
+ * });
+ *
+ * @name slideDown
+ * @type jQuery
+ * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
+ * @param Function callback (optional) A function to be executed whenever the animation completes.
+ * @cat Effects
+ * @see slideUp(String|Number,Function)
+ * @see slideToggle(String|Number,Function)
+ */
+ slideDown: function(speed,callback){
+ return this.animate({height: "show"}, speed, callback);
+ },
+
+ /**
+ * Hide all matched elements by adjusting their height and firing an
+ * optional callback after completion.
+ *
+ * Only the height is adjusted for this animation, causing all matched
+ * elements to be hidden in a "sliding" manner.
+ *
+ * @example $("p").slideUp("slow");
+ *
+ * @example $("p").slideUp("slow",function(){
+ * alert("Animation Done.");
+ * });
+ *
+ * @name slideUp
+ * @type jQuery
+ * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
+ * @param Function callback (optional) A function to be executed whenever the animation completes.
+ * @cat Effects
+ * @see slideDown(String|Number,Function)
+ * @see slideToggle(String|Number,Function)
+ */
+ slideUp: function(speed,callback){
+ return this.animate({height: "hide"}, speed, callback);
+ },
+
+ /**
+ * Toggle the visibility of all matched elements by adjusting their height and firing an
+ * optional callback after completion.
+ *
+ * Only the height is adjusted for this animation, causing all matched
+ * elements to be hidden in a "sliding" manner.
+ *
+ * @example $("p").slideToggle("slow");
+ *
+ * @example $("p").slideToggle("slow",function(){
+ * alert("Animation Done.");
+ * });
+ *
+ * @name slideToggle
+ * @type jQuery
+ * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
+ * @param Function callback (optional) A function to be executed whenever the animation completes.
+ * @cat Effects
+ * @see slideDown(String|Number,Function)
+ * @see slideUp(String|Number,Function)
+ */
+ slideToggle: function(speed, callback){
+ return this.each(function(){
+ var state = jQuery(this).is(":hidden") ? "show" : "hide";
+ jQuery(this).animate({height: state}, speed, callback);
+ });
+ },
+
+ /**
+ * Fade in all matched elements by adjusting their opacity and firing an
+ * optional callback after completion.
+ *
+ * Only the opacity is adjusted for this animation, meaning that
+ * all of the matched elements should already have some form of height
+ * and width associated with them.
+ *
+ * @example $("p").fadeIn("slow");
+ *
+ * @example $("p").fadeIn("slow",function(){
+ * alert("Animation Done.");
+ * });
+ *
+ * @name fadeIn
+ * @type jQuery
+ * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
+ * @param Function callback (optional) A function to be executed whenever the animation completes.
+ * @cat Effects
+ * @see fadeOut(String|Number,Function)
+ * @see fadeTo(String|Number,Number,Function)
+ */
+ fadeIn: function(speed, callback){
+ return this.animate({opacity: "show"}, speed, callback);
+ },
+
+ /**
+ * Fade out all matched elements by adjusting their opacity and firing an
+ * optional callback after completion.
+ *
+ * Only the opacity is adjusted for this animation, meaning that
+ * all of the matched elements should already have some form of height
+ * and width associated with them.
+ *
+ * @example $("p").fadeOut("slow");
+ *
+ * @example $("p").fadeOut("slow",function(){
+ * alert("Animation Done.");
+ * });
+ *
+ * @name fadeOut
+ * @type jQuery
+ * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
+ * @param Function callback (optional) A function to be executed whenever the animation completes.
+ * @cat Effects
+ * @see fadeIn(String|Number,Function)
+ * @see fadeTo(String|Number,Number,Function)
+ */
+ fadeOut: function(speed, callback){
+ return this.animate({opacity: "hide"}, speed, callback);
+ },
+
+ /**
+ * Fade the opacity of all matched elements to a specified opacity and firing an
+ * optional callback after completion.
+ *
+ * Only the opacity is adjusted for this animation, meaning that
+ * all of the matched elements should already have some form of height
+ * and width associated with them.
+ *
+ * @example $("p").fadeTo("slow", 0.5);
+ *
+ * @example $("p").fadeTo("slow", 0.5, function(){
+ * alert("Animation Done.");
+ * });
+ *
+ * @name fadeTo
+ * @type jQuery
+ * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
+ * @param Number opacity The opacity to fade to (a number from 0 to 1).
+ * @param Function callback (optional) A function to be executed whenever the animation completes.
+ * @cat Effects
+ * @see fadeIn(String|Number,Function)
+ * @see fadeOut(String|Number,Function)
+ */
+ fadeTo: function(speed,to,callback){
+ return this.animate({opacity: to}, speed, callback);
+ },
+
+ /**
+ * A function for making your own, custom animations. The key aspect of
+ * this function is the object of style properties that will be animated,
+ * and to what end. Each key within the object represents a style property
+ * that will also be animated (for example: "height", "top", or "opacity").
+ *
+ * Note that properties should be specified using camel case
+ * eg. marginLeft instead of margin-left.
+ *
+ * The value associated with the key represents to what end the property
+ * will be animated. If a number is provided as the value, then the style
+ * property will be transitioned from its current state to that new number.
+ * Otherwise if the string "hide", "show", or "toggle" is provided, a default
+ * animation will be constructed for that property.
+ *
+ * @example $("p").animate({
+ * height: 'toggle', opacity: 'toggle'
+ * }, "slow");
+ *
+ * @example $("p").animate({
+ * left: 50, opacity: 'show'