
function rand(n) {
  return Math.floor(Math.random() * n * 0.999)
}

function init() {
  setInterval(wissel, 4000);
}

function wissel() {
  if (fotos.length <= 5)
    return;
    
  var i = rand(AANTAL_FOTOS);
  var n;
  do {
    n = rand(fotos.length);
  } while (already_shown(n));
  console.log("foto"+i+", "+fotos[n]);
  document.images["foto"+i].src = fotos[n];
}

function already_shown(n) {
  for(var i=0; i<AANTAL_FOTOS; i++) {
    var foto = document.images["foto"+i].src;
    if (foto.indexOf(fotos[n]) >= 0)
      return true;
  }
  return false;
}


