/*
 * Unobtrusive javascript for onload event
 * Version 1.0
 * released 6.6.2006
*/

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
};


function setMenu() {
  $$('.subNavigation .toggleItem').each(function(el){
  	el.setStyle('display', 'none');
  });

  if ($('active_menu').value != ''){
    var myAccordion = new Accordion('.subNavigation .controlItem', '.subNavigation .toggleItem',{ display :$('active_menu').value, onActive: function(toggler, element){ element.setStyle('display', 'block')}, onBackground: function(toggler, element){element.setStyle('display', 'none')}});
  }else{
    var myAccordion = new Accordion('.subNavigation .controlItem', '.subNavigation .toggleItem',{ start:"all-closed", onActive: function(toggler, element){element.setStyle('display', 'block')}, onBackground: function(toggler, element){element.setStyle('display', 'none')}});
  }
};

/*
 function setMenu() {
  var togglers 	= $$('.subNavigation .controlItem ');
  var stretchers 	= $$('.subNavigation .toggleItem');

  if ($('active_menu').value != ''){
    var myAccordion = new Accordion(togglers,stretchers,{ display :$('active_menu').value});

  }else{
    var myAccordion = new Accordion(togglers,stretchers,{ start:"all-closed"});
  }
 };
*/

function windowHeight() {
    var height = 0;
    if( typeof( window.innerHeight ) == 'number' ) {
  //Non-IE
  height = window.innerHeight;
    } else if( document.documentElement && document.documentElement.clientHeight ) {
  //IE 6+ in 'standards compliant mode'
  height = document.documentElement.clientHeight;
    } else if( document.body && document.body.clientHeight ) {
  //IE 4 compatible
  height = document.body.clientHeight;
    }
    return parseInt(height);
}

function setHeight() {
  if (document.getElementById) {
    var minHeight = windowHeight() - 100;
    var bodyPanel = document.getElementById('bodyPanel');
    if (bodyPanel != null){
      bodyPanel.style.height = minHeight + 'px';
    }
  }
}

function setHwwweight(){
  var bodyPanel = $('bodyPanel');
  bodyPanel.offsetHeight = 600;
  alert(bodyPanel.offsetHeight);

}

addLoadEvent(setMenu);
//addLoadEvent(setHeight);

