/**
 * This javasript code, will create a full html page.
 * The vars that are being used are the div names of the main divs being used.
 *
 *    +-main------------------------------------------------------+
 *    | +-top---------------------------------------------------+ |
 *    | |                                                       | |
 *    | |                                                       | |
 *    | +-------------------------------------------------------+ |
 *    | +-body--------------------------------------------------+ |
 *    | | +-menu----------------------------------------------+ | |
 *    | | |                                                   | | |
 *    | | +---------------------------------------------------+ | |
 *    | | +-left--+ +-content---------------------------------+ | |
 *    | | |       | |                                         | | |
 *    | | |       | |                                         | | |
 *    | | |       | |                                         | | |
 *    | | |       | |                                         | | |
 *    | | |       | |                                         | | |
 *    | | |       | |                                         | | |
 *    | | |       | |                                         | | |
 *    | | |       | |                                         | | |
 *    | | +-------+ +-----------------------------------------+ | |
 *    | +-------------------------------------------------------+ |
 *    +-----------------------------------------------------------+
 *
 * It is verry important to add this javascript under the last html tag </html>. 
 * Otherwise the divs can't be loaded in the right order.
 *
 * Good to know: if you use any margin's, add the value in the calculation:
 * document.body.clientHeight-top.offsetHeight-menu.offsetHeight - MARGIN'S VALUE
 * so try to avoid margin in the main divs, use them in the div inside the main
 * divs.
 */

function set( )
{
	var top = document.getElementById('top');
	var menu = document.getElementById('menu');
	var content = document.getElementById('content');
	var footer = document.getElementById('footer');

	var def_contentheight;

	if (document.getElementById('top')) topheight = top.offsetHeight; else topheight = 0;
	if (document.getElementById('footer')) footerheight = footer.offsetHeight; else footerheight = 0;
	
	if (document.getElementById('content')) contentheight = content.offsetHeight; else contentheight = 0;
	if (document.getElementById('menu')) menuheight = menu.offsetHeight; else menuheight = 0;
	
	if( contentheight < (document.body.clientHeight-topheight ) ) {
		def_contentheight = (document.body.clientHeight-topheight-menuheight-footerheight );
		content.style.height = def_contentheight + 'px';
	} else {
		content.style.height = contentheight + 'px';
	}
}

