var _debugMode = false;

/* Custom Background Box Class */
var BackgroundBoxes = Class.create({
  initialize: function(boxSelector, backgroundClass, backgroundOpacity){
    this.boxSelector = boxSelector;
    this.backgroundClass = backgroundClass;
    this.backgroundOpacity = backgroundOpacity;
    document.observe('dom:loaded', this.setup.bind(this));
  },
  setup: function(){
    this.boxes = $$(this.boxSelector);
    for (var i = this.boxes.length - 1; i >= 0; i--){
      this.boxes[i].insert(
        new Element('div', { 'class': this.backgroundClass }).setStyle({ 'opacity': this.backgroundOpacity })
      );
      if (Prototype.Browser.IE) this.boxes[i].down('.' + this.backgroundClass).setStyle({ 'height': this.boxes[i].getHeight() + 'px' });
    }
  }
});


/* Insert transparent boxes */
var backgroundBoxes = new BackgroundBoxes('.box', 'background', .75);


/*

Doing some IE fixes
*/
if (Prototype.Browser.IE) {
  document.observe('dom:loaded', function(e){
    if ($('footBackground')) {
      $('footBackground').pngHack();
    }
    if ($$('ul.navNews li:first-child h5')[0]) {
      $$('ul.navNews li:first-child h5')[0].addClassName('noMarginTop');
    }
  });
}

/*

Inserting higher resolution print version of HHMA logo
*/
document.observe('window:loaded', function(e){
  if ($('head')){
    $('head').insert('<img src="/images/hhma-logo-print.png" alt="HHMA Logo" id="hhma-logo-print" style="display: none;" />')
  }
});