function IsIE8Browser() {
    var rv = -1;
    var ua = navigator.userAgent;
    var re = new RegExp("Trident\/([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null) {
        rv = parseFloat(RegExp.$1);
    }
    return (rv == 4);
}


function calculateHeights()
{
	var blockHeight = document.getElementById('blocks').scrollHeight;
	
	if(document.getElementById('verticalmenu'))
	{
		var verticalmenuHeight = document.getElementById('verticalmenu').scrollHeight;
		
		if(verticalmenuHeight > blockHeight)
			blockHeight = verticalmenuHeight;
			
		document.getElementById('verticalmenu').style.height = blockHeight + 'px';
	}
	
	if(document.getElementById('verticalmenuborder'))
		document.getElementById('verticalmenuborder').style.height = blockHeight + 'px';

	if(menuHorizontal == 1 && menuCenter == 1)
	{
		if(!IsIE8Browser()){
		
		var menuWidth = document.getElementById("horizontalmenu").childNodes[0].offsetWidth;
		if(974 - menuWidth > 2)
		{
			var marginBothSides = (974 - menuWidth) / 2;
			document.getElementById('horizontalmenu').childNodes[0].style.left = marginBothSides + 'px'; 
		}
			
		}
	}
	
	if(submenuHorizontal == 1 && submenuCenter == 1)
	{
		var submenuWidth = document.getElementById("horizontalsubmenu").childNodes[0].offsetWidth;
		console.log(submenuWidth);
		if(974 - submenuWidth > 2)
		{
			var marginBothSides = (974 - submenuWidth) / 2;
			document.getElementById('horizontalsubmenu').childNodes[0].style.left = marginBothSides + 'px'; 
		}
	}
	
	if(document.getElementById('container'))
	{
		var containerHeight = document.getElementById('container').scrollHeight;
		
		if(document.getElementById('shadowleft'))
			document.getElementById('shadowleft').style.height = containerHeight + 'px';
		
		if(document.getElementById('shadowright'))
			document.getElementById('shadowright').style.height = containerHeight + 'px';
	}
}

addOnload(function() { setTimeout("calculateHeights()", 10) });
