﻿// JScript File

// do not edit anything below this line
var t;
var j = -1;
var p = galleryarray.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = imageDir+galleryarray[i];
}

function runSlideShow() {
    j = (j + 1) % p;

    if (document.all) {
        document.images.slideImg.style.filter="blendTrans(duration=2)";
        document.images.slideImg.style.filter="blendTrans(duration=crossFadeDuration)";
        document.images.slideImg.filters.blendTrans.Apply();
    }
    document.images.slideImg.src = preLoad[j].src;
    if (document.all) {
        document.images.slideImg.filters.blendTrans.Play();
    }
    t = setTimeout('runSlideShow()', slideShowSpeed);
}

function prevImage() {
    if  (j < 1) j = galleryarray.length;
    j = (j - 1) % p;
    if (document.all) {
    document.images.slideImg.style.filter="blendTrans(duration=2)";
    document.images.slideImg.style.filter="blendTrans(duration=crossFadeDuration)";
    document.images.slideImg.filters.blendTrans.Apply();
    }
    document.images.slideImg.src = preLoad[j].src;
    document.images.slideImg.filters.blendTrans.Play();
	stopSlideshow();
}

function stopSlideshow() {
    clearTimeout(t);
}

function startSlideShow() {
    var btn = document.getElementById("btnPlay");
    if (btn.src.indexOf("play")>-1) {
    //play button
        btn.src = btn.src.replace("play","pause");
        btn.title = "Pause Slideshow";
        btn.alt = "Pause Slideshow";
        runSlideShow();
    }
    else {
        //pause button
        btn.src = btn.src.replace("pause","play");
        btn.title = "Play Slideshow";
        btn.alt = "Play Slideshow";
        stopSlideshow();
    }
}