
    var next_start_img = 0;
    
    // FADER
    var Fader = new Class({
        Implements: Options,
        options: {
                pause: 8000,
                duration: 3000,
                loop: true,
                onComplete: Class.empty,
                onStart: Class.empty
        },
        initialize: function(container,options) {
                this.setOptions(options);
                this.container = $(container);
                this.imgs = this.container.getElements('img');
                this.imgs.setStyles({
                        'position':'absolute',
                        'top':0,
                        'left':0,
                        'opacity':0
                });
                this.imgs[0].setStyle('opacity',1);
                this.el = new Element('div',{'styles': {
                        'position':'relative'
            }});
            this.el.injectInside(this.container);
            this.el.adopt(this.imgs);
                this.next = 0;
                this.start();
        },
        start: function() {
                //this.show();
                //this.next = next_start_img;
                //alert(this.next);
                this.periodical = this.show.bind(this).periodical(this.options.pause);
        },
        stop: function() {
                $clear(this.periodical);
        },
        show: function() {
                if (!this.options.loop && this.next==this.imgs.length-1)
                    this.stop();
                
                //alert(this.next+"!="+next_start_img);
                if(this.next!=parseInt(next_start_img)) {
                    var prev = this.next;
                    this.next = parseInt(next_start_img);
                } else {
                    this.next = (this.next==this.imgs.length-1)?0:this.next+1;
                    var prev = (this.next==0)?this.imgs.length-1:this.next-1;
                }
                //alert(this.next);
                
                //alert(this.next);
                this.imgs[this.next].setStyle('display','');
                //this.imgs[this.next].fade('in');
                //this.imgs[prev].fade('out');
                this.imgs[this.next].set('tween', {duration: this.options.duration});
                this.imgs[this.next].tween('opacity', 1);
                this.imgs[prev].set('tween', {duration: this.options.duration});
                this.imgs[prev].tween('opacity', 0);
                
                next_start_img = this.next;
        }
    
    }); 

////////////////////// DOMREADY LINE //////////////////////
window.addEvent('domready', function() {
////////////////////// DOMREADY LINE //////////////////////
    
    
    if($chk($("startani-static"))) {
        var f = new Fader('startani-static');
    }


////////////////////// DOMREADY LINE //////////////////////
});
////////////////////// DOMREADY LINE //////////////////////
