// resizeContent.js: adjusts the height of the header to the window's height
// version 1.0, based on the famous Mootools :-))
// written 2007 by Sabine Weiss

if (window.ie) {
	correction = 2;
} else correction = 0;

function reinit () {
  if (height != getHeight()) {
    location.href = location.href;
  }
}

Element.extend({
        isVisible: function(){
                return (this.getStyle('display') != 'none' && this.getStyle('visibility') != 'hidden');
        },
        show: function(){
                return this.setStyle('display', '').setOpacity(1);
        },
        hide: function(collapse){
                return (collapse) ? this.setStyle('display', 'none') : this.setOpacity(0);
        },
        toggle: function(collapse){
                return (this.isVisible()) ? this.hide(collapse) : this.show();
        }
});


window.addEvent('domready', function(){
    $('maincontainer').hide(1);
    $('bottom-box').hide(1);
    height = getHeight();
    headerheight = height - 450 - correction;
    if (headerheight < 25) {
      headerheight = 25;
      }
    var heightChange = new Fx.Style($('header'), 'height', {duration:500});
    heightChange.set(headerheight);
    $('maincontainer').show();
    $('bottom-box').show();
//    window.onresize = reinit;
// Make sure IE7 get's the chance to actually fire the event (prevents IE7 from looping...):
    var timeout = null;
    window.addEvent('resize', function() {
    	if (window.ie) { $clear(timeout); timeout = reinit.delay(300); }
      	else { reinit(); }
    });
});