//Control slideshows from SiteSpinner. Include this file in your page
//Extended to now include slideshows with i-frames
//V1.1 by Bruceee, October 2004

function SlideShow(Slides)
//Setup code for a slideshow as a Javascript object
{
this.LastShown = null; //ID of last slide shown
this.SlideNum = 0;     //Index of current slide being displayed
this.TimerID=0;	//ID of timer so we can stop it
this.Interval=0;       //Pause in secs between timed slides
this.Iframe=false;     //I-frame slideshows are different
this.target=0;	 //Name of i-frame being targetted
if (Slides!=undefined) {
  this.List = Slides.split(","); //String list of slides in this slideshow
  this.Iframe=(Slides.search("[^A-Za-z]")>0);//Anything with no alphabetic is in-page
}
this.hide = Hide;
this.show = showImage;
this.nextslide=nextSlide;
this.prevslide=prevSlide;
this.starttimer = startTimer;
this.stoptimer=stopTimer;
}

function Hide() {
//Hide last shown image
HiddenID=this.LastShown;
if (HiddenID!=null) {HiddenID.style.visibility = "hidden"};
}

function showImage(aID)
//Hide existing displayed image, then display a new one
{
if (this.Iframe) {
  frames[this.target].location = aID+'.html'
}
  else {
    this.hide (); 
    this.LastShown=document.getElementById("Oobj" + aID);
    if (this.LastShown==null) {
      alert('Can\'t show image obj'+aID+' -- not on this page')
    } 
    else {
      this.LastShown.style.visibility = "visible";
    }
  }
}

function nextSlide()
//Display next slide of a series
{
this.SlideNum++;
if (this.SlideNum >= this.List.length) {
  this.SlideNum=0;
 }
this.show(this.List[this.SlideNum]);
}

function prevSlide()
//Display previous slide of a series
{
this.SlideNum--;
if (this.SlideNum < 0) {
  this.SlideNum=this.List.length-1;
}
this.show(this.List[this.SlideNum]);
}

function startTimer(aName, aInterval) {
//Start a timed slideshow
if (this.TimerID==0){
  this.Interval = aInterval;
  this.TimerID = setInterval(aName+".nextslide()",aInterval*1000)
 }
}

function stopTimer() {
//Stop a timed slideshow
clearInterval(this.TimerID)
this.TimerID=0
}

//</script>


