// JavaScript functions for auto slideshow 

// variables defined in separate file: doSlides, linkornot, slidedelay
// arrays defined in separate file: Slides, photoslink

// Manual Slide show functions

var which=0;  
var ie=document.all;
var dom=document.getElementById;
	
// Start function definitions

function preLoadSlides() {
	var prepSlides=new Array()
	for (i=0;i<Slides.length;i++){
		prepSlides[i]=new Image()
		prepSlides[i].src=Slides[i][0]
	}
}

/*
function keeptrack(){
	window.status="Image "+(which+1)+" of "+Slides.length
}

function checkButtons(){
	if (ie) {
		document.all.Previous.disabled = (which == 0);
		document.all.Next.disabled = (which == (Slides.length-1));  }
	else if (dom) {
		document.getElementById("Previous").disabled = (which == 0);
		document.getElementById("Next").disabled = (which == (Slides.length-1));  }
	else {
		document.slideshow.document.Previous.disabled = (which == 0);
		document.slideshow.document.Next.disabled = (which == (Slides.length-1));  }
}

function backward(){
	if (which>0)
		which--;
	else 
		which=Slides.length-1;
	document.images.photomat.src=Slides[which][0];
	putCaption();
	keeptrack();					
}

function forward(){
	if (which<Slides.length-1)
		which++;
	else
		which=0;

	document.images.photomat.src=Slides[which][0];
	putCaption();
	keeptrack();
}
 
function putCaption(){
	captionobj=dom? document.getElementById("captionCell") : ie? document.all.captionCell : document.slideshow.document.captionCell;
	thisCaption = Slides[which][1];
	if (document.layers){
		captionobj.document.write(thisCaption);
		captionobj.document.close();	}
	else if (ie||dom)
		captionobj.innerHTML=thisCaption;
}

function getSlide(thisSlide) {
	which = thisSlide - 1;
	forward();
}		
*/
function transport(){
	if (which>0)
		doThis=which-1;
	else
		doThis=Slides.length-1;
	window.location=photoslink[doThis];
}

function rotateSlides() {
	if (doSlides) {
		document.images.photomat.src=Slides[which][0];
		if (which<Slides.length-1)
			which++;
		else
			which=0;
			
		setTimeout("rotateSlides()",slidedelay);
	}
}


//setup for slides
if (doSlides) preLoadSlides();
