function fade() {

	if ( typeof fade._initialized == "undefined" ) {

		this.duration = 0.4;
		
		fade.prototype.setDuration = function( duration ) {
			this.duration = duration;
		}

		fade.prototype.setElement = function( elem ) {
			this.elem = elem;
		}

		fade.prototype.fadeOut = function( callback ) {
			// create the animation
			var aniObj = new YAHOO.util.Anim(
				this.elem,
				{ opacity: {from: 1, to: 0 } },
				this.duration,
				YAHOO.util.Easing.easeBoth
			);

			if ( typeof( callback ) != "undefined" ) aniObj.onComplete.subscribe( callback );
			aniObj.animate();
		}

		fade.prototype.fadeIn = function( callback ) {
			// create the animation
			var aniObj = new YAHOO.util.Anim(
				this.elem,
				{ opacity: {from: 0, to: 1 } },
				this.duration,
				YAHOO.util.Easing.easeBoth
			);

			if ( typeof( callback ) != "undefined" ) aniObj.onComplete.subscribe( callback );
			aniObj.animate();
		}

		fade._initialized = true;

	} // end if initialized 
} // end fade
   