﻿//var ImageList = new Array()
//var CurrentIndex = 0;        **** Defined in SlideShow.aspx ***

function ShowNextImage() {
    try {
        CurrentIndex++;
        if (CurrentIndex == Images.length) 
            CurrentIndex = 0;
        $("ImageView").style.backgroundImage = "url('"+ ImagePath + Images[CurrentIndex] + "')";
        $("CaptionText").innerText = Captions[CurrentIndex];
    }
    catch (e) { }
}

function ShowPreviousImage() {
    try {
        CurrentIndex--;
        if (CurrentIndex < 0) 
            CurrentIndex = Images.length - 1;
        $("ImageView").style.backgroundImage = "url('" + ImagePath + Images[CurrentIndex] + "')";
        $("CaptionText").innerText = Captions[CurrentIndex];
    }
    catch (e) { }
}

function StartSlideShow(Title, xmlFileName) {
    var SlideShowURL = "SlideShow.aspx?fn=" + xmlFileName
    if (Title == null) {
        Title = "Slide Show"
    }
    if (SlideShowURL == null) return;
    if (!$("SlideShowFrame")) {
        var newFrame = document.createElement("iframe");
        newFrame.setAttribute('id', 'SlideShowFrame');
        newFrame.setAttribute("frameborder", "0");
        newFrame.setAttribute("style", "display: none; text-align:left");
        //newDiv.style.display = 'block';
        window.document.body.appendChild(newFrame);
    }
    $("SlideShowFrame").src = SlideShowURL;
    DivBox.show($("SlideShowFrame"), { title: Title, width: 646, height: 570, overlayOpacity: .4, vAlignMiddle: false, overlayClose: false });
    
}


