/*
* Fixes a bug that keeps the scrollbars of a div with overflow: auto float above the lightbox 
* in firefox mac.
* This script sets overflow to hidden on activation of the lightbox. 
* Called with onclick from the thumbnail image.
* The script BrowserDetect.js is needed for this to work.
*/

function fixLightbox() {
  if (BrowserDetect.browser == 'Firefox' && BrowserDetect.OS == 'Mac') {
    // the div element with overflow: auto
    var oDivToControl = document.getElementById('container');  
    // the link that closes the lightbox
    var oLightboxCloseLink = document.getElementById('lbCloseLink'); 
    // set the overflow of the div to hidden
    oDivToControl.style.overflow = 'hidden'; 
    // add an event listener to reset overflow to auto on closing of the lightbox
    oLightboxCloseLink.addEventListener(
      'click',
      function() {
        oDivToControl.style.overflow = 'auto';
      },
      false
    ); 
  }
}