var flag = true;

function recalcScrols(someDiv)
{
	if (someDiv.clientHeight < someDiv.scrollHeight)
	{		
		someDiv.style.overflowY = 'scroll';
	}	
	else
	{
		someDiv.style.overflowY = 'hidden';
	}
}

function calcTableSize()
{
	if ((!document.all) || flag)
	{		
		var d1 = document.getElementById('d1');
		var d2 = document.getElementById('d2');
		var d3 = document.getElementById('d3');
		
		if (document.body.clientHeight > 260)
		{		
			d1.style.height = Math.round(document.body.clientHeight - 260) + 'px';
			d2.style.height = d3.style.height = Math.round((d1.clientHeight - 45) / 2) + 'px';
			var correction = d1.clientHeight - d2.clientHeight - d3.clientHeight - 43;
			d2.style.height = Math.round((d1.clientHeight - 25) / 2 + correction) + 'px';
			
			recalcScrols(d1);
			recalcScrols(d2);
			recalcScrols(d3);
		}
		flag = false;
	}
	else
	{
		flag = true;
	}
}
