+/*
+ * I originally wrote fx() as a clone of moo.fx and in the process
+ * of making it small in size the code became illegible to sane
+ * people. You've been warned.
+ */
+
+jQuery.fx = function( elem, options, prop ){
+
+ var z = this;
+
+ // The users options
+ z.o = {
+ duration: options.duration || 400,
+ complete: options.complete
+ };
+
+ // The element
+ z.el = elem;
+
+ // The styles
+ var y = z.el.style;
+
+ // Simple function for setting a style value
+ z.a = function(){
+ if ( prop == "opacity" ) {
+ if (z.now == 1) z.now = 0.9999;
+ if (window.ActiveXObject)
+ y.filter = "alpha(opacity=" + z.now*100 + ")";
+ y.opacity = z.now;
+ } else
+ y[prop] = z.now+"px";
+ };
+
+ // Figure out the maximum number to run to
+ z.max = function(){
+ return z.el["orig"+prop] || z.cur();
+ };
+
+ // Get the current size
+ z.cur = function(){
+ return parseFloat( jQuery.css(z.el,prop) );
+ };
+
+ // Start an animation from one number to another
+ z.custom = function(from,to){
+ z.startTime = (new Date()).getTime();
+ z.now = from;
+ z.a();
+
+ z.timer = setInterval(function(){
+ z.step(from, to);
+ }, 13);
+ };
+
+ // Simple 'show' function
+ z.show = function(){
+ y.display = "block";
+ z.o.auto = true;
+ z.custom(0,z.max());
+ };
+
+ // Simple 'hide' function
+ z.hide = function(){
+ // Remember where we started, so that we can go back to it later
+ z.el["orig"+prop] = this.cur();
+
+ // Begin the animation
+ z.custom(z.cur(),0);
+ };
+
+ // IE has trouble with opacity if it doesn't have layout
+ if ( jQuery.browser == "msie" && !z.el.currentStyle.hasLayout )
+ y.zoom = 1;
+
+ // Remember the overflow of the element
+ z.oldOverflow = y.overflow;
+
+ // Make sure that nothing sneaks out
+ y.overflow = "hidden";
+
+ // Each step of an animation
+ z.step = function(firstNum, lastNum){
+ var t = (new Date()).getTime();
+
+ if (t > z.o.duration + z.startTime) {
+ // Stop the timer
+ clearInterval(z.timer);
+ z.timer = null;
+
+ z.now = lastNum;
+ z.a();
+
+ // Reset the overflow
+ y.overflow = z.oldOverflow;
+
+ // If the element was shown, and not using a custom number,
+ // set its height and/or width to auto
+ if ( (prop == "height" || prop == "width") && z.o.auto )
+ jQuery.setAuto( z.el, prop );
+
+ // If a callback was provided, execute it
+ if( z.o.complete && z.o.complete.constructor == Function ) {
+
+ // Yes, this is a weird place for this, but it needs to be executed
+ // only once per cluster of effects.
+ // If the element is, effectively, hidden - hide it
+ if ( y.height == "0px" || y.width == "0px" )
+ y.display = "none";
+
+ // Execute the complete function
+ z.o.complete.apply( z.el );
+ }