ListItemScroller = new Class({
    initialize: function(list, speed){
        this.selectedIndex = 0;
        this.list = list;
        this.speed = speed;
        this.operation = "+";
    },

    update: function(){
        this.list.getChildren().each(function(item, index)  {
            //alert(this.selectedIndex + " : " + index);
            if (index == this.selectedIndex)    {
                item.addClass("selected");
                //item.setStyle("background-color","pink");
            } else    {
                item.removeClass("selected");
                //item.setStyle("background-color","blue");
            }
        }.bind(this));
        
        
        if ((this.operation == "+") && this.selectedIndex >= (this.list.getChildren().length-1))   {
            this.operation = "-";
        } else if((this.operation == "-") && this.selectedIndex <= 0) {
            this.operation = "+";
        }
        
        
        if (this.operation == "-") this.selectedIndex--;
        else if (this.operation == "+") this.selectedIndex++;
        
    },

    stop: function(){
        $clear(this.periodicalTimer);
    },

    start: function(){
        this.periodicalTimer = this.update.periodical(this.speed, this);
    }
});

