
function initSlideShow(tagName, images, timeout) {
  if (!images) return;

  var i = new Array(images.length);
  for (j=0; j<images.length; j++) {
    i[j] = new Image();
    i[j].src = images[j];
  }
  showSlides(tagName, images, 0, timeout);
}


function showSlides(tagName, images, currentImg, timeout) {
  if (!document.images) return;
  if (!timeout) timeout = 2500;
  if (currentImg < images.length-1) currentImg++
  else currentImg = 0;
  document.images[tagName].src = images[currentImg];
  var s = arrayToString( images );
  setTimeout( "showSlides('"+ tagName +"', "+ s +", "+ currentImg +", "+ timeout +")",  timeout);
}

function arrayToString(a) {
  s = "[";
  for (j=0; j<a.length; j++) {
    s = s +"'"+ a[j] + "'";
    if (j < a.length-1) s=s+",";
  }
  s=s+"]";
  return s;
}


function showBigImage(id) {
  var e = document.getElementById(id);
  var i = e.src;
  var n = i.lastIndexOf('.');
  var ext = i.substr(n, i.length - n);
  var bigImg = i.substr(0,n) +'_BIG.png'; //+ ext;
  window.open(bigImg, 'Greensy in the wabe - Screenshot', 'width=550,height=460');
}