
/* 
SlideShow. Written by PerlScriptsJavaScripts.com
Copyright http://www.perlscriptsjavascripts.com 
Free and commercial Perl and JavaScripts     
*/

// transition effect. number between 0 and 23, 23 is random effect
var effect = 23; 

// transition duration. number of seconds effect lasts
var duration = 1.5; 

// seconds to diaply each image?
var display = 3;

// width of stage (first image)
var oW = 450;

// height of stage
var oH = 338;

// zoom width by (add or subtracts this many pixels from image width)
var zW = 40;

// zoom height by 
var zH = 30;

// path to image/name of image in slide show. this will also preload all images
// each element in the array must be in sequential order starting with zero (0)
SLIDES = new Array();

SLIDES[0]  = ["images/show1.jpg", "Picture1"];
SLIDES[1]  = ["images/show2.jpg", "Picture2"];
SLIDES[2]  = ["images/show3.jpg", "Picture3"];
SLIDES[3]  = ["images/show4.jpg", "Picture4"];
SLIDES[4]  = ["images/show5.jpg", "Picture5"];
SLIDES[5]  = ["images/show6.jpg", "Picture6"];
SLIDES[6]  = ["images/show7.jpg", "Picture7"];
SLIDES[7]  = ["images/show8.jpg", "Picture8"];
SLIDES[8]  = ["images/show9.jpg", "Picture9"];
SLIDES[9]  = ["images/show10.jpg", "Picture10"];
SLIDES[10]  = ["images/show11.jpg", "Picture11"];
SLIDES[11]  = ["images/show12.jpg", "Picture12"];
SLIDES[12]  = ["images/show13.jpg", "Picture13"];
SLIDES[13]  = ["images/show14.jpg", "Picture14"];
SLIDES[14]  = ["images/show15.jpg", "Picture15"];
SLIDES[15]  = ["images/show16.jpg", "Picture16"];

// end required modifications

S = new Array();
for(a = 0; a < SLIDES.length; a++){
	S[a] = new Image(); S[a].src  = SLIDES[a][0];
}

function showit()
{
f = document._slideShow;
n = 0;
t = 0;

document.images["stage"].width  = oW;
document.images["stage"].height = oH;
f.delay.value = display;

// add image numbers to select menu
f.wichIm.options.length = 0;
for(i in SLIDES){
	f.wichIm.options[i] = new Option(SLIDES[i][1],i);
}
}

function startSS(){
	t = setTimeout("runSS(" + f.currSlide.value + ")", 1 * 1);
}

function runSS(n){
	n++;
	if(n >= SLIDES.length){
		n = 0;
	}
	document.images["stage"].src = S[n].src;
	if(document.all && navigator.userAgent.indexOf("Opera") < 0 && navigator.userAgent.indexOf("Windows") >= 0){
		document.images["stage"].style.visibility = "hidden";
		document.images["stage"].filters.item(0).apply();
		document.images["stage"].filters.item(0).transition = effect;
		document.images["stage"].style.visibility = "visible";
		document.images["stage"].filters(0).play(duration);
	}
	f.currSlide.value = n;
	f.wichIm[n].selected = true;
	t = setTimeout("runSS(" + f.currSlide.value + ")", f.delay.value * 1000);
}

function stopSS(){
	if(t){
		t = clearTimeout(t);
	}
}

function nextSS(){
	stopSS();
	n = f.currSlide.value;
	n++;
	if(n >= SLIDES.length){
		n = 0;
	}
	if(n < 0){
		n = SLIDES.length - 1;
	}
	document.images["stage"].src = S[n].src;
	f.currSlide.value = n;
	f.wichIm[n].selected = true;
	if(document.all && navigator.userAgent.indexOf("Opera") < 0 && navigator.userAgent.indexOf("Windows") >= 0){
		document.images["stage"].style.visibility = "hidden";
		document.images["stage"].filters.item(0).apply();
		document.images["stage"].filters.item(0).transition = effect;
		document.images["stage"].style.visibility = "visible";
		document.images["stage"].filters(0).play(duration);
	}
}

function prevSS(){
	stopSS();
	n = f.currSlide.value;
	n--;
	if(n >= SLIDES.length){
		n = 0;
	}
	if(n < 0){
		n = SLIDES.length - 1;
	}
	document.images["stage"].src = S[n].src;
	f.currSlide.value = n;
	f.wichIm[n].selected = true;
	
	if(document.all && navigator.userAgent.indexOf("Opera") < 0 && navigator.userAgent.indexOf("Windows") >= 0){
		document.images["stage"].style.visibility = "hidden";
		document.images["stage"].filters.item(0).apply();
		document.images["stage"].filters.item(0).transition = effect;
		document.images["stage"].style.visibility = "visible";
		document.images["stage"].filters(0).play(duration);
	}
}

function selected(n){
	stopSS();
	document.images["stage"].src = S[n].src;
	f.currSlide.value = n;
	
	if(document.all && navigator.userAgent.indexOf("Opera") < 0 && navigator.userAgent.indexOf("Windows") >= 0){
		document.images["stage"].style.visibility = "hidden";
		document.images["stage"].filters.item(0).apply();
		document.images["stage"].filters.item(0).transition = effect;
		document.images["stage"].style.visibility = "visible";
		document.images["stage"].filters(0).play(duration);
	}
}

function zoom(dim1, dim2){
	if(dim1){
		if(document.images["stage"].width < oW){
			document.images["stage"].width   = oW;
			document.images["stage"].height  = oH;
		} else {
			document.images["stage"].width  += dim1;
			document.images["stage"].height += dim2;
		}
		if(dim1 < 0){
			if(document.images["stage"].width < oW){
				document.images["stage"].width   = oW;
				document.images["stage"].height  = oH;
			}
		}
	} else {
		document.images["stage"].width   = oW;
		document.images["stage"].height  = oH;
	}
}

