﻿function startFsNewsTkr() {
    var cntSize = $('fst_NwsCont').getSize();
    $('fst_NswCntFlt').setStyle('padding-bottom', cntSize.y);
    var scrSize = $('fst_NwsCont').getScrollSize();
    var myFx = new Fx.Scroll($('fst_NwsCont'), { duration: (scrSize.y - cntSize.y) * 50, transition: 'linear',
        onComplete: function() {
            (function() {
                $('fst_NswCntFlt').setStyle('opacity', '0');
                this.set(0, 0);
                $('fst_NswCntFlt').morph({ 'opacity': '1' });
                this.options.duration = (scrSize.y - cntSize.y) * 50;
                if (this.options.duration <= 0) return;
                this.toBottom.delay(3000, this);
            }).delay(1000, this);
        }
    });
    $('fst_NswCntFlt').addEvents({
        'mouseenter': function() {
            myFx.cancel();
        },
        'mouseleave': function() {
            var cuScr = $('fst_NwsCont').getScroll();
            myFx.options.duration = (scrSize.y - cuScr.y - cntSize.y) * 50;
            myFx.toBottom();
        },
        'mousewheel': function(event) {
            event = new Event(event);
            var cuScr = $('fst_NwsCont').getScroll();
            if (event.wheel > 0) cuScr.y -= 12;
            else if (event.wheel < 0) cuScr.y += 12;
            myFx.set(cuScr.x, cuScr.y);
            event.stop();
        }
    });
    $('fst_NswCntFlt').setStyle('opacity', '0');
    myFx.set(0, 0);
    $('fst_NswCntFlt').morph({ 'opacity': '1' });
    myFx.toBottom.delay(3000, myFx);
}