
gezichtjes = new Array();
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/1.gif');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/2.gif');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/stel_kids_8.jpg');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/stel_kids_11.jpg');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/stel_kids_3.jpg');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/stel_kids_10.jpg');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/stel_kids_5.jpg');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/stel_kids_7.jpg');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/stel_kids_6.jpg');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/stel_kids_9.jpg');
gezichtjes.push(Globals.webRoot + 'gfx/gezichtjes/stel_kids_4.jpg');

headerfotos = new Array();
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/1.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/2.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/3.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/4.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/5.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/6.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/7.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/8.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/9.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/10.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/11.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/12.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/13.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/14.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/15.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/16.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/17.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/18.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/19.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/20.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/21.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/22.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/23.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/24.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/25.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/26.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/27.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/28.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/29.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/30.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/31.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/32.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/33.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/34.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/35.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/36.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/37.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/38.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/39.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/40.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/41.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/42.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/43.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/44.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/45.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/46.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/47.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/48.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/49.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/50.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/51.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/52.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/53.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/54.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/55.jpg');
headerfotos.push(Globals.webRoot + 'gfx/^catalpa.js/56.jpg');

var fotonumber = 0;

function init()
{
  var W3CDOM = (document.createElement && document.getElementsByTagName);
  if (!W3CDOM) return;

  var test = new Image();
  var tmp = new Date();
  var suffix = tmp.getTime();
  test.src = '../gfx/gezichtjes/1d41d.gif?'+suffix;
  test.onload = replaceGezichtje;
  replaceHeaderFotos();
  setInterval("replaceHeaderFotos()",12000);
}

function replaceHeaderFotos()
{
  setTimeout("replaceHeaderFoto(1)",3000);
  setTimeout("replaceHeaderFoto(2)",6000);
  setTimeout("replaceHeaderFoto(3)",9000);
  setTimeout("replaceHeaderFoto(4)",12000);
  setTimeout("replaceHeaderFoto(5)",15000);
}

function getRandomGezichtje()
{
  var ndx = getRandomIndex(gezichtjes.length);
  return(gezichtjes[ndx]);
}

function replaceGezichtje()
{
  var gezichtjetag = document.getElementById('gezichtjes');
  if (gezichtjetag)
  {
    gezichtjetag.src = getRandomGezichtje();
  }
}

function replaceHeaderFoto(number)
{
  var thisheaderphoto = document.getElementById('headerphoto' + number);

  if (thisheaderphoto.id)
  {
    thisheaderphoto.src = headerfotos[fotonumber];
    fotonumber = (fotonumber + 1) % headerfotos.length;
    thisheaderphoto.style.display = "inline";
  }
}


function getRandomIndex(_length)
{
  // return a random image from the array
  currentdate = new Date();
  mseconds = currentdate.getTime();
  index = mseconds % _length;
  return(index);
}


window.onload = function()  {
  init();
}

