function SlideShowPicture (name, pictures, thumbs) {
    this.idx = 0;
    this.name = name;
    this.pictures = pictures;
    this.thumbs = thumbs;
    this.prevLink = $('#'+name+' .sspicture-rewind');
    this.nextLink = $('#'+name+' .sspicture-forward');
    this.pictureLink = $('#'+name+' .sspicture-picture');
    var me = this;
    this.prevLink.click(function() {me.clickPrevious(); return false;});
    this.nextLink.click(function() {me.clickNext(); return false;});
    this.pictureLink.click(function() {me.clickPicture(); return false;});

    this.redraw();
}

SlideShowPicture.prototype.redraw = function () {
    $('img', this.prevLink)[0].src = this.idx == 0 ? '/cms-admin/img/silk/control_rewind.png' : '/cms-admin/img/silk/control_rewind_blue.png';
    $('img', this.nextLink)[0].src = this.idx < this.pictures.length - 1 ? '/cms-admin/img/silk/control_fastforward_blue.png' : '/cms-admin/img/silk/control_fastforward.png';
    $('img', this.pictureLink)[0].src = this.thumbs[this.idx];
}

SlideShowPicture.prototype.clickPrevious = function() {
    if (this.idx == 0) return false;
    this.idx--;
    this.redraw();
}

SlideShowPicture.prototype.clickNext = function() {
    if (this.idx > this.pictures.length - 2) return false;
    this.idx++;
    this.redraw();
}

SlideShowPicture.prototype.clickPicture = function() {
    //alert(this.pictures[this.idx]);
    window.open(this.pictures[this.idx], 'picture', 'width=600,height=600');
}
