

function writeRandomImage(_array) 
{
  var imageIndex = parseInt(Math.random() * _array.length);
  document.write("<img src=" + _array[imageIndex] + ">");
}

function writeRandomImageWithLegend(_images, _legends) 
{
  var dum;
  var imageIndex = parseInt(Math.random() * _images.length);
  document.write("<table border='0' cellspacing='0' cellpadding='0''>");
  document.write("<tr><td class='legend' valign='top'>");
  document.write("<img src='" + _images[imageIndex] + "'></td><td class='legend'><img src='./images/pixel.gif' border='0' width='10'></td><td class='legend' valign='top'>");
  if (imageIndex > _legends.length - 1)
    document.write(_legends[0]);
  else
    document.write(_legends[imageIndex]);
  document.write("</td></tr></table>");
}

function showPictures(page, largeur, hauteur, options) 
{
  var ToTop = (screen.height - hauteur) / 2;
  var ToLeft = (screen.width - largeur) / 2;
  var win = window.open(page, "screenshots", ("top=" + ToTop + ", left=" + ToLeft + ", width=" + largeur + ", height=" + hauteur + ", " + options));
  win.focus();
}


function showHide(id, v) 
{
  var obj = document.getElementById(id);
  if (obj) {
    obj.style.visibility = v;
  }
}

function show(id ,n)
{
  showHide(id,'visible');
  for(i=0;i<n;i++){
    legend = 'legend'+i;
    if (legend != id)
      showHide(legend,'hidden');
  }
}

function showMain(n)
{ 
  show(main ,n);
}
