function refresh()
{
	height = browserwindow.height;
	width = browserwindow.width;

	browserwindow = new getwindow();

	if ((height != browserwindow.height) || (width != browserwindow.width))
	{
		window.history.go(0);
	}
}

function scroll()
{
	browserwindow = new getwindow();

	if (browserwindow.scrollTopOffset > 150)
	{
		document.getElementById("nav").style.top = browserwindow.scrollTopOffset - 150 + "px";
	}
	else
	{
		document.getElementById("nav").style.top = "0px";
	}
}

function getwindow()
{
	if (window.innerHeight)
	{
		this.height = window.innerHeight;
	}
	else if (document.body && document.body.offsetHeight)
	{
		this.height = document.body.offsetHeight - 4;
	}
	else
	{
		this.height = 0;
	}

	if (window.innerWidth)
	{
		this.width = window.innerWidth;
	}
	else if (document.body && document.body.offsetWidth)
	{
		this.width = document.body.offsetWidth;
	}
	else
	{
		this.width = 0;
	}

	if (window.pageYOffset)
	{
		this.scrollTopOffset = window.pageYOffset;
	}
	else if (document.body && document.body.scrollTop)
	{
		this.scrollTopOffset = document.body.scrollTop;
	}
	else
	{
		this.scrollTopOffset = 0;
	}

	if (window.pageXOffset)
	{
		this.scrollLeftOffset = window.pageXOffset;
	}
	else if (document.body && document.body.scrollLeft)
	{
		this.scrollLeftOffset = document.body.scrollLeft;
	}
	else
	{
		this.scrollLeftOffset = 0;
	}
}

browserwindow = new getwindow();

window.onresize = refresh;
window.onscroll = scroll;

