var images = 1;
var words = 1;

function back() {
  if (images > 1) {
   images--;
   document.change.slides.src=photos[images-1];
   words--;
   document.change.explain.value=message[words-1]; }
   if (document.change.theButton.value == "Stop") { window.clearTimeout(TI); }
   document.change.theButton.value = "Auto";
  }

function next() {
  if (photos.length > images) {
   document.change.slides.src=photos[images];
   images++;
   document.change.explain.value=message[words];
   words++; }
   if (document.change.theButton.value == "Stop") { window.clearTimeout(TI); }
   document.change.theButton.value = "Auto";
}

function auto(msg) {
  if (photos.length > images) {
   document.change.slides.src=photos[images];
   images++;
   document.change.explain.value=message[words];
   words++; }
  if (msg == "Auto") { document.change.theButton.value = "Stop"; }
  if (msg == "Stop") { document.change.theButton.value = "Auto"; }
  if (document.change.theButton.value == "Auto") {
   window.clearTimeout(TI);
   image = 1;
   back();
   return true; }
  TI=window.setTimeout("auto()", 5000);
  if (images==photos.length) { images=1;words=1; }
}

function restart() {
  back();
  document.change.slides.src=photos[0];
  images = 1;
  document.change.explain.value=message[0];
  words = 1;
  if (document.change.theButton.value == "Stop") { window.clearTimeout(TI); }
  document.change.theButton.value = "Auto";
}
