//Credits and Copyrights:
/* 
SlideShow. Written by PerlScriptsJavaScripts.com
Copyright http://www.perlscriptsjavascripts.com 
Free and commercial Perl and JavaScripts     
*/
/*Modified by Fran Corpier February 2009 (see "fac" notations), 
modifications, Copyright 2009, Fran Corpier. Permission to use as long as this 
copyright notice is maintained as is, whereis.*/

//windows transition effect. number between 0 and 23, 23 is random effect
var effect = 0; 
//transition duration. number of seconds effect lasts
var duration = 1.5; 
//seconds to display each image?
var delay = 10;
//hard coded width and height of stage (first image)
var oW = 400;
//height of stage
var oH = 400;
//zoom width by (add or subtracts this many pixels from image width)
var zW = 50;
//zoom height by 
var zH = 50;

//fac vars 
var defaultClass = "w400";
var imgClass = "w400";
var n=0,t=0,d,f,g,newwidth=400,newheight=400,maxwidth=950;


//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)
//fac added year and artist to array
SLIDES = new Array();

SLIDES[0]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Frandywarhol|950&style=mid", "Frandy Warhol", "2009", "F.A. Moore"];
SLIDES[1]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Remember|800&style=mid", "Remember", "2009", "F.A. Moore"];
SLIDES[2]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Lipsremember%206|800&style=mid", "Lipsremember 6", "2009", "F.A. Moore"];
SLIDES[3]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Lipsremember%205|800&style=mid", "Lipsremember 5", "2009", "F.A. Moore"];
SLIDES[4]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Lipsremember%204|800&style=mid", "Lipsremember 4", "2009", "F.A. Moore"];
SLIDES[5]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Lipsremember%203|800&style=mid", "Lipsremember 3", "2009", "F.A. Moore"];
SLIDES[6]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Deeppurple|800&style=mid", "Deeppurple", "2009", "F.A. Moore"];
SLIDES[7]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Desertwind|800&style=mid", "Desertwind", "2009", "F.A. Moore"];
SLIDES[8]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Goldensilk|800&style=mid", "Goldensilk", "2009", "F.A. Moore"];
SLIDES[9]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Floraldream|800&style=mid", "Floraldream", "2009", "F.A. Moore"];
SLIDES[10]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Grow|800&style=mid", "Grow", "2009", "F.A. Moore"];
SLIDES[11]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Ocreblue|800&style=mid", "Ocreblue", "2009", "F.A. Moore"];
SLIDES[12]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Ocreheart|800&style=mid", "Ocreheart", "2009", "F.A. Moore"];
SLIDES[13]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Pinkmumplate|800&style=mid", "Pinkmumplate", "2009", "F.A. Moore"];
SLIDES[14]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Tigerfeet|800&style=mid", "Tigerfeet", "2009", "F.A. Moore"];
SLIDES[15]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Sabrina%20and%20Annalene|800&style=mid", "Sabrina and Annalene", "2009", "F.A. Moore"];
SLIDES[16]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Sheeba%20and%20Kris|700&style=mid", "Sheeba and Kris", "2009", "F.A. Moore"];
SLIDES[17]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Flesh%20and%20Blood|800&style=mid", "Flesh and Blood", "2009", "F.A. Moore"];
SLIDES[18]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Infinite%20Light|800&style=mid", "Infinite Light", "2009", "F.A. Moore"];
SLIDES[19]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Waterborn|900&style=lrg", "Waterborn", "2009", "F.A. Moore"];
SLIDES[20]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Waterborn%202|900&style=lrg", "Waterborn 2", "2009", "F.A. Moore"];
SLIDES[21]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Waterborn%203|900&style=lrg", "Waterborn 3", "2009", "F.A. Moore"];
SLIDES[22]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Waterborn%204|900&style=lrg", "Waterborn 4", "2009", "F.A. Moore"];
SLIDES[23]  = ["http://fran.ws/cgi-bin/imdev.cgi?im=Rain|900&style=lrg", "Rain", "2009", "F.A. Moore"];


//this will take a while if images are gen'd by cgi script as mine are (fac)
S = new Array();
for(a = 0; a < SLIDES.length; a++){
	S[a] = new Image(); 
	S[a].src  = SLIDES[a][0];
}

//fac
function setup() 
{
	d = document.getElementById('telldelay');
	f = document._slideShow;
	g = document.getElementById('stage');	

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

	// add image numbers to select menu
	f.wichIm.options.length = 0;
	for(i in SLIDES){
		f.wichIm.options[i] = new Option(SLIDES[i][1] + ', Copyright ' + SLIDES[i][2] +', ' + SLIDES[i][3],i);
	}
}
//play
function startSS(){
	t = setTimeout("runSS(" + f.currSlide.value + ")", 1 * 1);
	d.innerHTML = delay + ' sec. delay';//fac
}

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){
		g.style.visibility = "hidden";
		g.filters.item(0).apply();
		g.filters.item(0).transition = effect;
		g.style.visibility = "visible";
		g.filters(0).play(duration);
	}
	f.currSlide.value = n;
	f.wichIm[n].selected = true;
	t = setTimeout("runSS(" + f.currSlide.value + ")", f.delay.value * 1000);
}
//pause or stop
function stopSS(){
	if(t){
		t = clearTimeout(t);
	}
	d.innerHTML = '&nbsp;'; //fac
}
//forward
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){
		g.style.visibility = "hidden";
		g.filters.item(0).apply();
		g.filters.item(0).transition = effect;
		g.style.visibility = "visible";
		g.filters(0).play(duration);
	}
}
//back
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){
		g.style.visibility = "hidden";
		g.filters.item(0).apply();
		g.filters.item(0).transition = effect;
		g.style.visibility = "visible";
		g.filters(0).play(duration);
	}
}
//menu item selected
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){
		g.style.visibility = "hidden";
		g.filters.item(0).apply();
		g.filters.item(0).transition = effect;
		g.style.visibility = "visible";
		g.filters(0).play(duration);
	}
}
//fac
function zoom(dim1, dim2) 
{	
	if(dim1){
		if (newwidth >= oW && newwidth <= maxwidth){
			if (newwidth + dim1 < oW || newwidth + dim1 > maxwidth) {
				//no change!!
			} else {
				newwidth    += dim1;
				imgClass    = "w" + newwidth;
				g.className = imgClass;
			}
		} else {
			//no change!!
		}
		
	} else {
		g.className = "defaultClass";
	}
}
//fac
window.onload = setup;

