-$.speed = function(s,o) {
- if ( o && o.constructor == Function ) o = { onComplete: o };
- o = o || {};
- var ss = {"crawl":1200,"xslow":850,"slow":600,"medium":400,"fast":200,"xfast":75,"normal":400};
- o.duration = typeof s == "number" ? s : ss[s] || 400;
- return o;
-};
-
-$.fn.hide = function(a,o) {
- o = $.speed(a,o);
- return a ? this.each(function(){
- new fx.FadeSize(this,o).hide();
- }) : this._hide();
-};
-
-$.fn.show = function(a,o) {
- o = $.speed(a,o);
- return a ? this.each(function(){
- new fx.FadeSize(this,o).show();
- }) : this._show();
-};
-
-$.fn.slideDown = function(a,o) {
- o = $.speed(a,o);
- return this.each(function(){
- new fx.Resize(this,o).show("height");
- });
-};
-
-$.fn.slideUp = function(a,o) {
- o = $.speed(a,o);
- return this.each(function(){
- new fx.Resize(this,o).hide("height");
- });
-};
-
-$.fn.fadeOut = function(a,o) {
- o = $.speed(a,o);
- return a ? this.each(function(){
- new fx.Opacity(this,o).hide();
- }) : this._hide();
-};
-
-$.fn.fadeIn = function(a,o) {
- o = $.speed(a,o);
- return a ? this.each(function(){
- new fx.Opacity(this,o).show();
- }) : this._show();
-};
-
-$.fn.center = function(f) {
- return this.each(function(){
- if ( !f && this.nodeName == 'IMG' &&
- !this.offsetWidth && !this.offsetHeight ) {
- var self = this;
- setTimeout(function(){
- $(self).center(true);
- }, 13);
- } else {
- var s = this.style;
- var p = this.parentNode;
- if ( $.css(p,"position") == 'static' )
- p.style.position = 'relative';
- s.position = 'absolute';
- s.left = parseInt(($.css(p,"width") - $.css(this,"width"))/2) + "px";
- s.top = parseInt(($.css(p,"height") - $.css(this,"height"))/2) + "px";
+jQuery.fn.extend({
+
+ // overwrite the old show method
+ _show: jQuery.fn.show,
+
+ /**
+ * The effects module overloads the show method to now allow
+ * for a speed to the show operation. What actually happens is
+ * that the height, width, and opacity to the matched elements
+ * are changed dynamically. The only three current speeds are
+ * "slow", "normal", and "fast". For example:
+ * $("p").show("slow");
+ * Note: You should not run the show method on things
+ * that are already shown. This can be circumvented by doing this:
+ * $("p:hidden").show("slow");
+ */
+ show: function(speed,callback){
+ return speed ? this.animate({
+ height: "show", width: "show", opacity: "show"
+ }, speed, callback) : this._show();
+ },
+
+ // Overwrite the old hide method
+ _hide: jQuery.fn.hide,
+
+ /**
+ * The hide function behaves very similary to the show function,
+ * but is just the opposite.
+ * $("p:visible").hide("slow");
+ */
+ hide: function(speed,callback){
+ return speed ? this.animate({
+ height: "hide", width: "hide", opacity: "hide"
+ }, speed, callback) : this._hide();
+ },
+
+ /**
+ * This function increases the height and opacity for all matched
+ * elements. This is very similar to 'show', but does not change
+ * the width - creating a neat sliding effect.
+ * $("p:hidden").slideDown("slow");
+ */
+ slideDown: function(speed,callback){
+ return this.animate({height: "show"}, speed, callback);
+ },
+
+ /**
+ * Just like slideDown, only it hides all matched elements.
+ * $("p:visible").slideUp("slow");
+ */
+ slideUp: function(speed,callback){
+ return this.animate({height: "hide"}, speed, callback);
+ },
+
+ /**
+ * Adjusts the opacity of all matched elements from a hidden,
+ * to a fully visible, state.
+ * $("p:hidden").fadeIn("slow");
+ */
+ fadeIn: function(speed,callback){
+ return this.animate({opacity: "show"}, speed, callback);
+ },
+
+ /**
+ * Same as fadeIn, but transitions from a visible, to a hidden state.
+ * $("p:visible").fadeOut("slow");
+ */
+ fadeOut: function(speed,callback){
+ return this.animate({opacity: "hide"}, speed, callback);
+ },
+
+ /**
+ * ...
+ */
+ fadeTo: function(speed,to,callback){
+ return this.animate({opacity: to}, speed, callback);
+ },
+
+ /**
+ *
+ */
+ animate: function(prop,speed,callback) {
+ return this.queue(function(){
+ var i = 0;
+ for ( var p in prop ) {
+ var e = new jQuery.fx( this, jQuery.speed(speed,callback,i++), p );
+ if ( prop[p].constructor == Number )
+ e.custom( e.cur(), prop[p] );
+ else
+ e[ prop[p] ]();
+ }
+ });
+ },
+
+ /**
+ *
+ * @private
+ */
+ queue: function(type,fn){
+ if ( !fn ) {
+ fn = type;
+ type = "fx";
+ }
+
+ return this.each(function(){
+ if ( !this.queue )
+ this.queue = {};
+
+ if ( !this.queue[type] )
+ this.queue[type] = [];
+
+ this.queue[type].push( fn );
+
+ if ( this.queue[type].length == 1 )
+ fn.apply(this);
+ });
+ }
+
+});
+
+jQuery.extend({
+
+ setAuto: function(e,p) {
+ // Remember the original height
+ var a = e.style[p];
+
+ // Figure out the size of the height right now
+ var o = jQuery.curCSS(e,p,1);
+
+ // Set the height to auto
+ e.style[p] = e.currentStyle ? "" : "auto";
+
+ // See what the size of "auto" is
+ var n = jQuery.curCSS(e,p,1);
+
+ // Revert back to the original size
+ if ( o != n && n != "auto" ) e.style[p] = a;
+ },
+
+ speed: function(s,o,i) {
+ o = o || {};
+
+ if ( o.constructor == Function )
+ o = { complete: o };
+
+ var ss = { slow: 600, fast: 200 };
+ o.duration = (s && s.constructor == Number ? s : ss[s]) || 400;
+
+ // Queueing
+ o.oldComplete = o.complete;
+ o.complete = function(){
+ jQuery.dequeue(this, "fx");
+ if ( o.oldComplete && o.oldComplete.constructor == Function )
+ o.oldComplete.apply( this );
+ };
+
+ if ( i > 0 )
+ o.complete = null;
+
+ return o;
+ },
+
+ queue: {},
+
+ dequeue: function(elem,type){
+ type = type || "fx";
+
+ if ( elem.queue && elem.queue[type] ) {
+ // Remove self
+ elem.queue[type].shift();
+
+ // Get next function
+ var f = elem.queue[type][0];
+
+ if ( f ) f.apply( elem );