//Event.observe(window, 'load', loadAccordions, false);

function loadAccordions() {
    var navAccordion = new accordion('#nav_container', {
	classNames : {
	    toggle : 'expander',
	    toggleActive : 'expanded',
	    content : 'expand_content'
	}
    });

    if(navactive) {
	navAccordion.activate($$('#nav_container .expander')[navactive-1]);
    }
}

function fixheights() {   
    document.getElementById('nav_container').style.padding = "12px 0 12px 50px";
    document.getElementById('entry').style.padding = "20px 20px 0px 20px";
    var menuheight = document.getElementById("nav_container").offsetHeight;
    var contentheight = document.getElementById("main").offsetHeight;
    if((menuheight + 135) < contentheight) {
	document.getElementById('nav_container').style.padding = "12px 0 "+ (contentheight - (menuheight + 123)) + "px 50px";
    } else {
	document.getElementById('entry').style.padding = "20px 20px "+(menuheight+135-contentheight) + "px 20px";
    }
}

function accordion_done() {
    fixheights();
}

window.onload = loadAccordions;
