// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// fixed Javascript errors when using next/previous on first/last image, 
// TF 2/24/2005 for adventurescom.com

var playShow = true;
var onNext = false;
var onPrev = false;
var firstTime = 1;
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(playShow){
		if(firstTime==1){
			speedMSFade = (speedMS/3);
			firstTime=0;
		} else {
			speedMSFade = speedMS;
		}
		if (document.all){
			document.images.SlideShow.style.filter="blendTrans(duration=2)"
			document.images.SlideShow.style.filter="blendTrans(duration=fadeDur)"
			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()', speedMSFade)
	}
}
function skipToNext(){
	playShow = false;
	onNext = true;
	if (onPrev){
		onPrev = false;
		j = j + 1;
		// added next line TF 2/24/05 to fix JS error
		if (j > (p-1)) j=0
	}
	clearTimeout(t);
	// alert("about to show "+j);
	document.images.SlideShow.src = preLoad[j].src
	if (document.all){
	  document.images.SlideShow.filters.blendTrans.Stop()
	}
	j = j + 1;
	if (j > (p-1)) j=0
	t = setTimeout('playShow = true;runSlideShow();', 10000)
}
function skipToPrev(){
	onPrev = true;
	if (playShow) {
	 	j = j - 1;
		playShow = false;
	}	
	if (onNext){
		// modified to catch negative TF 2/24/05 to fix JS error
		if (j < 1){
			j = p-1;
		} else {
			j = j - 1;
		}
	}
	clearTimeout(t);
	j = j - 1;
	if (j < 0) {
		j=p-1;
	}
	// alert("about to show "+j);
	document.images.SlideShow.src = preLoad[j].src
	if (document.all){
	  document.images.SlideShow.filters.blendTrans.Stop()
	}
	t = setTimeout('playShow = true;runSlideShow();', 10000)
}