var timerID = null;
var timerRunning = false; 
var minIndx = 0;

var count = 0;


function Init() {
  minIndx = 0;
  maxIndx = ImageList.length - 1; // bepaal de hoogste waarde voor de index
  count = 0
}

function previous() {
  --count;
  if (count < minIndx) { count = maxIndx }
  document.JSImage.src = ImageList[count].src
}
function setImage(j){
	count = j;
	document.JSImage.src = ImageList[j].src
}
function next() {
  ++count;
  if (count > maxIndx) { count = minIndx }
  document.JSImage.src = ImageList[count].src
}

// hieronder staan de functies voor de timer van de diashow...
function stopclock(){
  if(timerRunning) 
  clearTimeout(timerID);
  timerRunning=false;
}

function startclock(pform) {
  if (timerRunning) {
  pform.ViewButton.value = "Start foto show";
  stopclock()
  }
  else {
  pform.ViewButton.value = "Stop foto show";
  showtime()
  }
}

function showtime() {
  timerID = setTimeout("showtime()",4000);
  timerRunning = true;
  next()
}
// einde verbergen script -->
