//By: Eric Nevala (31JAN06)
//This file needs to be called AFTER the layers have been set.
//Assumptions: 
//		-There is a BackgroundLayer layer
//		-There is a SideNav layer
//Description: this adjusts a layer to either dynamically match the height of a window or the length of the document content

var MyLayer = document.getElementById("BackgroundLayer");
var TopOffset = 117;

//if the window is smaller then the content, then scale to the length of the content
if((document.body.clientHeight - TopOffset) < (document.getElementById("ContentLayer").offsetHeight + 10))
{
	MyLayer.style.height = document.getElementById("ContentLayer").offsetHeight + 10;
	SideNav.style.height = document.getElementById("ContentLayer").offsetHeight + 10;
}
else
{//otherwise, scale to the size of the window (content is smaller then window)

	//Note: 117 is a magic number. The top layer is 117 pixels from the top of the window.	
	MyLayer.style.height = document.body.clientHeight - TopOffset;
	SideNav.style.height = document.body.clientHeight - TopOffset;
}