var i_imagemax = 21;
var i_jn = 1;

window.onload=function() {
  /* random picture */
  i_jn = Math.floor( Math.random() * i_imagemax ) + 1;
  setThumb();
  
  document.getElementById("s_next").onclick = function(){scrshot_jn(+1);return true;};
  document.getElementById("s_prev").onclick = function(){scrshot_jn(-1);return true;};
  document.getElementById("img_jn").onclick = function(){
    openWin("./images/screenshots/big/screenshot_"+i_jn+".png","Ubuntu-fr",820,620);
    return true;
  }
}

function openWin(fileToOpen,nameOfWindow,width,height) {
  window.open(fileToOpen,"Ubuntu-fr","menubar=no,scrollbars=no,status=no,width="+width+",height="+height);
}

function scrshot_jn(n) {
  i_jn += n;
  
  if (i_jn > i_imagemax) i_jn = 1;
  if (i_jn < 1) i_jn = i_imagemax;

  setThumb();
}

function setThumb() {
  document.getElementById("img_jn").src = "./images/screenshots/thumb/screenshot_" + i_jn + ".png";
}
