// Mootools 1.2 based vertical ticker
// (c)2010 Standupweb

// uses mootools core + Fx.Scroll from mootools more
var SwTicker = new Class({
    Implements: Options,
    el: 0,
    firstCall: true,
    options: {
        speed: 1500,	// scrolling duration (in ms)
        delay: 3000		// waiting time between 2 scrolls (in ms)
    },
    initialize: function(el, options){
        this.setOptions(options);
        this.el = $(el);
        this.fx = new Fx.Scroll(this.el, {
            duration: this.options.speed
        });
        this.scrollToNext.periodical(this.options.delay, this);
    },
    
    scrollToNext: function(){
        if (!this.firstCall) {
            this.el.getFirst().inject(this.el);
        }
        else {
            this.firstCall = false;
        }
        this.fx.set(0, 0);
        this.fx.start(0, this.el.getFirst().getSize().y);
    }
    
});

window.addEvent('domready', function(){
  var vert = new SwTicker('ticker');
}); 