/**
 * @author cperez
 * @date 2009-06-05
 * 
 * tabview with fading transition
 */

YAHOO.namespace('speedfc.widget');

(function() {
    YAHOO.speedfc.widget.ScrollTabView = function (el, attr) {
		YAHOO.speedfc.widget.ScrollTabView.superclass.constructor.call(this, el, attr); 
	}
    YAHOO.lang.extend(YAHOO.speedfc.widget.ScrollTabView, YAHOO.widget.TabView);

	var proto = YAHOO.speedfc.widget.ScrollTabView.prototype,
		Dom = YAHOO.util.Dom;
    proto.contentTransition = function(newTab, oldTab) {
        YAHOO.util.Dom.setStyle(newTab.get('contentEl'), 'opacity', 0);
		newTab.set('contentVisible', true);
        fadeOut = new YAHOO.util.Anim(oldTab.get('contentEl'),
			{opacity: {from:1, to: 0 }},
			1.5,
			this.get('easing')
		);
        fadeOut.onComplete.subscribe(function() {
			oldTab.set('contentVisible', false);
		});

		
        fadeIn = new YAHOO.util.Anim(newTab.get('contentEl'),
			{opacity: {from:0, to: 1 }},
			1.5,
			this.get('easing')
		);
        fadeOut.animate();
		fadeIn.animate();
	}
})();
