<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body style="margin:0px; padding:0px;">
<div id="div1" style="height:128px; background-color:red;"> sdfsdf<br><br>fsdf<br>fsdf</div>
<div id="div2" > sdfsdf<br><br>fsdf<br>fsdf</div>
<div id="div3" style="height:144px;background-color:blue;"> sdfsdf<br><br>fsdf<br>fsdf</div>
</dody>
<script>
alert(div1.offsetHeight);
alert(div2.offsetHeight);
alert(div3.offsetHeight);
alert(document.body.clientHeight);
if((div1.offsetHeight + div2.offsetHeight + div3.offsetHeight )<window.document.body.clientHeight)
{
div2.style.height= ( window.document.body.clientHeight- div1.offsetHeight-div3.offsetHeight )+"px";
}
</script>
</html>