﻿function registerEvent( element, eName, fun )
{
	if (element.addEventListener) {
		element.addEventListener (eName,fun,false);
	}
	else if (element.attachEvent) {
		element.attachEvent ("on"+eName,fun);
	}
}

function layout() {
	var control = document.getElementById( 'controlLayer' );
	var menu = document.getElementById( 'menu' );
	var content = document.getElementById( 'content' );
	
	bottom_height = document.getElementById( 'bottomSpace' ).offsetHeight;
	
	var min_height = control.offsetHeight - bottom_height;
	var menu_height = menu.offsetHeight + 192;
	var content_height = content.offsetHeight + 192;
	
	var height = Math.max( min_height, menu_height, content_height );
	
	document.getElementById( 'bottom' ).style.top = height + 'px';
	//document.getElementById( 'bottom' ).style.top = '400px';
	document.getElementById( 'bottom' ).style.display = 'block';
}

registerEvent( window, 'load', layout);
//registerEvent( window, 'resize', layout);