var boxTimers = new Array();

function showBox(boxID) {
  clearTimeout(boxTimers[boxID]);

  for (var k in boxTimers) {
    if ( k != boxID ) {
      initHide(k);
    }
  }

  var parentBox = document.getElementById('box'+boxID);
  var contentBox = document.getElementById('boxContent'+boxID);
  
  parentBox.style.backgroundImage = 'url(/kuvat/laatikko_231x100_b.png)';
  contentBox.style.display = 'block';
  contentBox.style.visibility = 'visible';
}

function hideBox(boxID) {
  var parentBox = document.getElementById('box'+boxID);
  var contentBox = document.getElementById('boxContent'+boxID);

  parentBox.style.backgroundImage = 'url(/kuvat/laatikko_231x100.png)';
  contentBox.style.display = 'none';
  contentBox.style.visibility = 'hidden';
}

function initHide(boxID) {
  boxTimers[boxID] = setTimeout("hideBox("+boxID+")", 1000);
}

function cancelHide(boxID) {
  clearTimeout(boxTimers[boxID]);
}
