

/**********************************/
/**** SiteCM 2.5 Slideshow ********/
/**********************************/

function SlideShowImage() {
    this.width = 0;
    this.height = 0;
    this.alt = "";
    this.url = "";
}

function SlideShow(id) {
    this.ID = id;
    this.Images = [];
    this.TotalImages = 0;
    this.CurrentImage = 1;
}

SlideShow.prototype.AddImage = function (alt, url, width, height) {
    var anImage = new SlideShowImage();
    anImage.alt = alt;
    anImage.url = url;
    anImage.width = width;
    anImage.height = height;
    this.Images[this.TotalImages] = anImage;
    this.TotalImages += 1;
};

SlideShow.prototype.Next = function () {
    if (this.CurrentImage + 1 <= this.TotalImages) {
        this.CurrentImage = this.CurrentImage + 1;
        this.ShowGraphic();
    }
};

SlideShow.prototype.Previous = function () {
    if (this.CurrentImage - 1 >= 1) {
        this.CurrentImage = this.CurrentImage - 1;
        this.ShowGraphic();
    }
};

SlideShow.prototype.First = function () {
    this.CurrentImage = 1;
    this.ShowGraphic();
};

SlideShow.prototype.Last = function () {
    this.CurrentImage = this.TotalImages;
    this.ShowGraphic();
};

SlideShow.prototype.ShowGraphic = function () {
    getObj("imagePlaceHolder_" + this.ID).src = "/SiteCM3/i/shim.gif";
    getObj("imagePlaceHolder_" + this.ID).src = this.Images[this.CurrentImage - 1].url;
    getObj("imagePlaceHolder_" + this.ID).height = this.Images[this.CurrentImage - 1].height;
    getObj("imagePlaceHolder_" + this.ID).width = this.Images[this.CurrentImage - 1].width;
    var textPlaceholder = getObj("textPlaceholder_" + this.ID);
    if (textPlaceholder) {
        textPlaceholder.innerHTML = this.Images[this.CurrentImage - 1].alt;
    }
    getObj("imageCounter_" + this.ID).innerHTML = '<span class="NavText NavTextCounter">' + this.CurrentImage + ' of ' + this.TotalImages + '</span>';
};
