

var slidearray = new Array();
var i; 
var bigness = 22;
var current = 0;
var stop=3;
var x = 0;

for (i=0; i<bigness; i++)
{
slidearray[i] = new Image(280, 280);
x = i+1;
slidearray[i].src = "images/fin" + x + ".jpg";
}

function startshow()
{
if (stop==3)
{
stop=0;
switchstuff();
}

if(stop==1){
stop=0;
switchstuff();
}

}

function clearcaptions()
{
document.getElementById("caption0").style.display = 'none';
document.getElementById("caption1").style.display = 'none';
document.getElementById("caption2").style.display = 'none';
document.getElementById("caption3").style.display = 'none';
document.getElementById("caption4").style.display = 'none';
document.getElementById("caption5").style.display = 'none';
document.getElementById("caption6").style.display = 'none';
document.getElementById("caption7").style.display = 'none';
document.getElementById("caption8").style.display = 'none';
document.getElementById("caption9").style.display = 'none';
document.getElementById("caption10").style.display = 'none';
document.getElementById("caption11").style.display = 'none';
document.getElementById("caption12").style.display = 'none';
document.getElementById("caption13").style.display = 'none';
document.getElementById("caption14").style.display = 'none';
document.getElementById("caption15").style.display = 'none';
document.getElementById("caption16").style.display = 'none';
document.getElementById("caption17").style.display = 'none';
document.getElementById("caption18").style.display = 'none';
document.getElementById("caption19").style.display = 'none';
document.getElementById("caption20").style.display = 'none';
document.getElementById("caption21").style.display = 'none';
}

function switchstuff()
{

if (stop==0){

current++;
if(current == bigness) current=0;

document.images["slideshow"].src = slidearray[current].src;
clearcaptions();
document.getElementById("caption"+current).style.display = 'block';
setTimeout("switchstuff()", 4000);
}

}
function backshow()
{
stop = 1;
current--;
if(current == -1) current = bigness - 1;

document.images["slideshow"].src = slidearray[current].src;
clearcaptions();
document.getElementById("caption"+current).style.display = 'block';


}
function forwardshow()
{
stop=1;
current++;
if(current == bigness) current=0;

document.images["slideshow"].src = slidearray[current].src;
clearcaptions();
document.getElementById("caption"+current).style.display = 'block';

}

function pauseshow()
{
stop = 1;

}
