/* Static variables */

//var avoidElements = new Array('head','foot');
var avoidElements = new Array();
/* End static variables */



/* Standard framework 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);*/ }
}

/* Standard framework function to maximize mCCWrapper to full window height and centering mCC within it. */

function center_center(CC,C){
	try {
		if($chk($('head'))) $('head').setStyle('display','none');
		if($chk($('foot'))) $('foot').setStyle('display','none');
		if($chk(CC)&&$chk(C)){
			var windowHeight = window.getSize().y;
			var space = (windowHeight-C.getSize().y)/2;
			var newHeight = windowHeight - space;
			CC.setStyle('padding-top',space+'px');
			CC.setStyle('height',newHeight+'px');
		}
	} 
	catch (e){ }
}


/* [Beta] Standard framework function to remove backgrounds from previous child, used in li menus */

function removeBackgroundOnPreviousChild(el){
	try {
		var previous = el.getFirst().get('rel') - 1;
		if(previous>0){
			var ul = $('nav').getChildren();
			ul[previous-1].getFirst().setStyle('background','none');
		}
	}
	catch (e){ }
}


/* [Beta] Standard framework function to make columns with same classname the same height as the highest one */

function makeSameHeight(elements){
	try {
		var heighest = 0;
		elements.each(function(el,i){	heighest = (el.getSize().y>heighest ? el.getSize().y : heighest); });
		elements.each(function(el,i){	el.setStyle('height',heighest+'px'); });
	}
	catch (e) {}
}
