/*


Dynamic Application of Functions to DOM
*/
var _debugMode = false;
document.observe('dom:loaded', init);
Event.observe(window, 'load', initAfterImages);


function init () {
  if ($('homeTop')) {
    [$('calloutText'), $('calloutBanner')].equalizeHeights();
    $$('.main .column').equalizeHeights();
  }
  
  $$('.download-button').invoke('pngHack');
  $('navPrimary').slidingDoorHover('hover');
}

function initAfterImages () {
  
}

Object.extend(Array.prototype, {
  equalizeHeights: function(){
    //equalize the heights of columns
    if (this.any(function(el){
      return Object.isElement(el)
    }))
      var maxHeight = this.map(function(el){
          return el.getHeight();
      }).max();
      this.each(function(el) {
        el.setStyle({height: 
          (maxHeight - Number(el.getStyle('padding-top').sub('px', '')) -
          Number(el.getStyle('padding-bottom').sub('px', ''))) + 'px'
        });
      });
    return this;
  }
});
