var mainh=document.getElementById('cont').offsetHeight; var part1h=document.getElementById('head').offsetHeight; var part2h=document.getElementById('menu').offsetHeight; mainh=part1+part2;