
var origWidth = 0;
var origHeight = 0;

window.onresize = resizeHandler;

function resizeHandler()
{
	var width = 0;
	var height = 0;
	if (window.innerHeight)
	{
		height = window.innerHeight;
		width = window.innerWidth;
	}
	else
	{
		if(document.documentElement.offsetHeight)
		{
			height = document.documentElement.offsetHeight;
			width = document.documentElement.offsetWidth;
		}
	}
	if (width != 0 && height != 0 && (width != origWidth || height != origHeight))
	{
		origWidth = width;
		origHeight = height;
		adjustHeight();
	}
}

function adjustHeight()
{
	var addition = 0;
	if(document.body.scrollHeight)
	{
		if (window.innerHeight)
		{
			addition = window.innerHeight - document.body.scrollHeight;
		}
		else if(document.documentElement.offsetHeight)
		{
			addition = document.documentElement.offsetHeight - document.body.scrollHeight;
		}
		else return;
	}
	var currHeight = document.getElementById("addition").style.height;
	var currAddition = parseInt(currHeight.substring(0, currHeight.length - 2));
	addition += currAddition + 1;
	document.getElementById("addition").style.height = (addition > 0 ? addition : "0") + "px";
}
