var ECSlide = new Class({
    
    slide: null,
    
    initialize: function(buttonList, contentList)
    {
        this.slide = new Fx.Accordion(buttonList, contentList, {
            onActive: function(toggler, element)
            {
                buttonList.each(function(item)
                {
                    item.getElement('img').setStyle('border', '1px solid #FFF')
                });
                
                toggler.getElement('img').setStyle('border', '1px solid #CCC');
            }
        });
    },
    
    current: function()
    {
        return this.slide.previous;
    },
    
    previous: function()
    {
        var currentItem = this.current();
        var next = currentItem - 1;
        
        if(next < 0) this.last();
        else this.display(next);
    },
    
    next: function()
    {
        var currentItem = this.current();
        var count = this.length();
        var next = currentItem + 1;
        
        if(next == count) this.first();
        else this.display(next);
    },
    
    first: function()
    {
        return this.display(0);
    },
    
    last: function()
    {
        return this.display(this.length() - 1);
    },
    
    display: function(ind)
    {
        return this.slide.display(ind);
    },
    
    length: function()
    {
        return this.slide.togglers.length;
    },
    
});
