var HeaderSlider = Class.create({
    initialize: function(images,imagesPath) {
        this.images = images;
        this.current = 0;
        this.imagesPath = imagesPath;
        this.imageDivs = new Array();
        this.pauseInSec = 7;
        this.duration = 1;

        this.drawImages();
        this.imageDivs[this.current].show();
        this.interval = setInterval("headerSlider.next()",this.pauseInSec*1000);
    },

    drawImages: function() {
        for(i=0;i<this.images.size();i++) {
            div = new Element('div');
            div.style.backgroundImage = "url("+this.imagesPath+this.images[i]+")";
            div.hide();
            div.className = 'pngfix header_image';
            this.imageDivs[i] = div;
            $('header_pictures').insert(div);
        }
    },

    next: function() {
        this.imageDivs[this.current].fade({duration:this.duration});

        this.current++

        if(this.current >= this.images.size()) {
            this.current = 0;
        }
        
        this.imageDivs[this.current].appear({duration:this.duration});
    }
});

