/* called immediately after loading*/

/*adjust heights*/
Event.observe(window, 'load', function() {adjustLeftBarHeight(); adjustTopMenuWidth(); adjustBottomMenuHeight();});
Event.observe(window, 'resize', function() {adjustLeftBarHeight();});


/* functions */
function adjustLeftBarHeight(){	
	max_bottom=document.viewport.getHeight();
	if ($('last_div').offsetTop > max_bottom){max_bottom=$('last_div').offsetTop;}

	$('left_container').style.height = (max_bottom-$('main_left').offsetTop) + "px";

}


function adjustBottomMenuHeight(){	
	y1=$('bottom_menu_container_spacer').offsetTop;
	y2= $('last_div').offsetTop;
	
	if (y2>(y1+25)){
		dy = y2-(y1+25);
		$('bottom_menu_container_spacer').style.height=dy+"px";
	}

	
}

/*the top menu a elements will get width depending on their char number*/
function adjustTopMenuWidth(){	
	distance_between_top_menu_items = 40;
	$$('#top_menu_container a').each(function(el) {				
		span=el.down(); //this is the internal span element
		//alert(span.getWidth());
		//el.innerHTML.length
  		//el.style.width=(22+(el.innerHTML.length * 9)) +'px';
	
		el.style.width=(distance_between_top_menu_items+span.getWidth()) +'px';				
		//el.style.border="1px solid red";
	});

}
