var current = 0;

function next(){ // forward one image
if(document.diapo.slide[current+1]){
document.images.show.src = document.diapo.slide[current+1].value;
document.diapo.slide.selectedIndex = ++current;}
else{first();}}

function previous(){ // back on image
if((current-1) >= 0){
document.images.show.src = document.diapo.slide[current-1].value;
document.diapo.slide.selectedIndex= --current;}
else{last();}}

function first(){ // jump to first image
current=0;
document.images.show.src = document.diapo.slide[0].value;
document.diapo.slide.selectedIndex=0;}

function last(){ // this is jump to last image
current=(document.diapo.slide.length-1);
document.images.show.src = document.diapo.slide[current].value;
document.diapo.slide.selectedIndex=current;}

function ap(text){ // this controls the auto-play and/or auto-stop
document.diapo.slidebutton.value=(text == "Stop") ? "Start" : "Stop";
rotate();}

function change(){ // this is for the pulldown menu
current=document.diapo.slide.selectedIndex;
document.images.show.src = document.diapo.slide[current].value;}

function rotate() {
if (document.diapo.slidebutton.value == "Stop") {
current = (current == document.diapo.slide.length-1) ? 0 : current+1;
document.images.show.src = document.diapo.slide[current].value;
document.diapo.slide.selectedIndex = current;
window.setTimeout("rotate()", 5000);}}

