/*  2005-05-21  Diaschau.js JavaScript 1.3 functions
    Dr. Rolf Schroeder
    Moeoerkenweg 37
    21029 Hamburg, Germany
    http://rschr.de
*/
var current  = 0;	// index of slide position
var aktiv    = 0;	// aktiv = Window.setInterval(fkt(),delay)
var time_ms  = 10000;        // delay in milliseconds for slide show

function button_set()
//       ##########
{
  document.write("<input type=button onClick=\"first();\" value=\"|<\">" + "&nbsp;");
  document.write("<input type=button onClick=\"previous();\" value=\"<\">" + "&nbsp;");
  document.write("<input type=button name=\"slidebutton\" onClick=\"ap(this.value,time_ms);\" value=\"Start\">" + "&nbsp;");
  document.write("<input type=button onClick=\"next();\" value=\">\">" + "&nbsp;");
  document.write("<input type=button onClick=\"last();\" value=\">|\">");
}

function reset()
//       #####
{
  window.clearInterval(aktiv);
  document.slideform.slidebutton.value = "Start"
}

function next()
//       ####
{
  if (document.slideform.slide[current+1])
    {
      reset();
      document.images.show.src = document.slideform.slide[current+1].value;
      document.slideform.slide.selectedIndex = ++current;
    }
  else first();
}

function previous()
//       ########
{
  if (current-1 >= 0)
    {
      reset();
      document.images.show.src = document.slideform.slide[current-1].value;
      document.slideform.slide.selectedIndex = --current;
    }
  else last();
}

function first()
//       #####
{
  reset();
  current = 0;
  document.images.show.src = document.slideform.slide[0].value;
  document.slideform.slide.selectedIndex = 0;
}

function last()
//       ####
{
  reset();
  current = document.slideform.slide.length-1;
  document.images.show.src = document.slideform.slide[current].value;
  document.slideform.slide.selectedIndex = current;
}

function ap(text,delay)	// initial text = "Start", delay in milliseconds
//       ##
{ 
  if (text == "Start")
    {
      document.slideform.slidebutton.value = "Stop";
      aktiv = window.setInterval("rotate()",delay);
    }
  else
    {
      reset();
    }
}

function change()
//       ######
{
  reset();
  current = document.slideform.slide.selectedIndex;
  document.images.show.src = document.slideform.slide[current].value;
}

function rotate()
//       ######
{
  if (document.slideform.slidebutton.value == "Stop")
    {
      current = (current == document.slideform.slide.length-1) ? 0 : current+1;
      document.images.show.src = document.slideform.slide[current].value;
      document.slideform.slide.selectedIndex = current;
    }
}

