My page layout looks something like this:
Use jquery and put this in the start of your tag:
and call the function checkheight(); in the end of your tag plus wherever you have onclick (or other) events that make the page longer or shorter in height.