function getWindowHeight() { 
	if (window.innerHeight) { 
		return window.innerHeight; 
	} else { 
		if (window.document.documentElement 
			&& window.document.documentElement.clientHeight) { 
			return window.document.documentElement.clientHeight; 
		} 
		return window.document.body.offsetHeight; 
	} 
}

function absTop(el) {
	return (el.offsetParent)?el.offsetTop+absTop(el.offsetParent) : el.offsetTop;
}

var height = getWindowHeight();  
var footer = document.getElementById("footer");
var offset = absTop(footer);
if (height>offset) {
	footer.style.height = (height-offset-20)+"px";
}

