/* Static variables */

var avoidElements = new Array('head','foot','nav_lower');

/* End static variables */


/* Standard function to give mCCWrapper the remaining window height if avoidElements is defined */

function autosize_mCCWrapper(){
	try { 
		var offsetHeight = 0;
		var windowHeight = window.getSize().y;
		avoidElements.each(function(el,i){
			offsetHeight += $(el).getSize().y;
		});
		var totalElementHeight = offsetHeight + $('mCC').getSize().y;
		if(totalElementHeight < windowHeight){
			var newHeight = windowHeight - offsetHeight;
			$('mCCWrapper').setStyle('height', newHeight+'px');
		}
	} 
	catch (e){ /* console.log(e);*/ }
}

function removeBackgroundOnPreviousChild(el){
	var previous = el.getFirst().get('rel') - 1;
	if(previous>0){

		var ul = $('nav').getChildren();
		ul[previous-1].getFirst().setStyle('background','none');
	}
}

function initLowerNav(el){
	$('nav_lower').setStyle('display','block');
	var section = 'section_'+el.getFirst().get('rel');
	if($chk($(section)))
		$(section).setStyle('display','block');
}
