var hasChangedInfoFrame = false;
function SBoxInfoFrames() {
  /* set info-frames to invisible if needed */
  if (document.getElementById('infoFrame') != null) {
    if (document.getElementById('infoFrame').style.display != 'none') {
      document.getElementById('infoFrame').style.display = 'none';
    }
    if (document.getElementById('infoFrame2') != null) {
      if (document.getElementById('infoFrame2').style.display == 'none') {
        document.getElementById('infoFrame2').style.display = 'block';
        document.getElementById('infoFrame2').src = 'moment.aspx';
        hasChangedInfoFrame = true;
      }
    }
  }
}
function OpenSBoxAuto(urlToBox) {
  SBoxInfoFrames();
  /* open shadowbox */
  Shadowbox.open({
    player:     'iframe',
    content:    urlToBox,
    options: {
      modal: false,
      onClose:    function(){ resetOverlay(); }
    }
  });
}
function OpenSBox(urlToBox) {
  SBoxInfoFrames();
  
  /* open shadowbox */
  Shadowbox.open({
    player:     'iframe',
    content:    urlToBox,
    width:      1020,
    height:     960,
    options: {
      modal: false,
      onClose:    function(){ resetOverlay(); }
    }
  });
}
function CloseSBox() {
  Shadowbox.close();
  if (hasChangedInfoFrame) {
    resetOverlay();
  }
  hasChangedInfoFrame = false;
}
function resetOverlay() {
  if (document.getElementById('infoFrame') != null) {
    document.getElementById('infoFrame').style.display = 'block';
  }
  if (document.getElementById('infoFrame2') != null) {
    document.getElementById('infoFrame2').style.display = 'none';
    document.getElementById('infoFrame2').style.overflow = 'scroll';
  }
  hasChangedInfoFrame = false;
}
function showFrame(frameId, frameUrl) {
  if (document.getElementById(frameId) != null) {
    document.getElementById(frameId).style.display = 'block';
    document.getElementById(frameId).src = decodeUrl(frameUrl);
  }
  if (frameId == 'infoFrame' && document.getElementById('infoFrame2') != null) {
    document.getElementById('infoFrame2').style.display = 'none';
  }
}
function menu_over(imgObject) {
  imgObject.src = '/images/topmenu/' + imgObject.id.toString() + 'b.jpg';
}
function menu_out(imgObject) {
  imgObject.src  = '/images/topmenu/' + imgObject.id.toString() + 'a.jpg';
}
