// =======================================
// set the following variables
// =======================================

// Is timer stopped?
var isStopped = false;

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'slideshow/Anzac-Parade.jpg';
Pic[1] = 'slideshow/Bridge-Cook.jpg';
Pic[2] = 'slideshow/Parliament-House2.jpg';
Pic[3] = 'slideshow/Carillon.jpg';
Pic[4] = 'slideshow/Parliament-House.jpg';

// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
    preLoad[i] = new Image()
    preLoad[i].src = Pic[i]
}

function runSlideShow(){
    if (preLoad.length == 1) {
        isStopped = true;
    }

    if (isStopped == false) {
        if (document.all){
            document.images.SlideShow.style.filter="blendTrans(duration=2)"
            document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
            document.images.SlideShow.filters.blendTrans.Apply()      
        }
        document.images.SlideShow.src = preLoad[j].src

        if (document.all){
            document.images.SlideShow.filters.blendTrans.Play()
        }
        j = j + 1
        if (j > (p-1)) j=0
            t = setTimeout('runSlideShow()', slideShowSpeed)
    }
}

function stopTimer() {
    if (isStopped == false) {
        isStopped = true;
        document.Slideshow.Pause.value = "Resume";
    } else {
        isStopped = false;
        document.Slideshow.Pause.value = "Pause";
        runSlideShow();
    }
}

function change_prev() {
    if (isStopped) {
        j = j - 1
        if (j < 1) j=p

        if (document.all){
            document.images.SlideShow.style.filter="blendTrans(duration=2)"
            document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
            document.images.SlideShow.filters.blendTrans.Apply()      
        }
        
        document.images.SlideShow.src = preLoad[j-1].src
        
        if (document.all){
            document.images.SlideShow.filters.blendTrans.Play()
        }
    }
}

function change_next() {
if (isStopped) {
      if (document.all){
    document.images.SlideShow.style.filter="blendTrans(duration=2)"
    document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
    document.images.SlideShow.filters.blendTrans.Apply()      
  }

  document.images.SlideShow.src = preLoad[j].src

  if (document.all){
    document.images.SlideShow.filters.blendTrans.Play()
  }

  j = j + 1
  if (j > (p-1)) j=0
    }
}
