/*	Function to fit screen size. */
function screenSize(){
	
	if (document.getElementById){
		
		// Get tag elements.
		divScroller = document.getElementById("scroller");
		divPage = document.getElementById("page");
		divContainer = document.getElementById("container");
		divPage = document.getElementById("page");
		divPageBackground = document.getElementById("page-background");
		divPageEdge = document.getElementById("page-edge");
		divEdgeTop = document.getElementById("edge-top");
		divEdgeBottom = document.getElementById("edge-bottom");
		divNavigation = document.getElementById("navigation");
		divContent = document.getElementById("content");
		liHome = document.getElementById("home").getElementsByTagName("a")[0];
		
		// Get window dimensions.
		if (window.innerHeight){
			wheight = window.innerHeight;
			wwidth = window.innerWidth;
			pageScroll = 50 + Math.max(divContent.scrollHeight, divNavigation.scrollHeight);
			pheight = Math.max(wheight, pageScroll);
		} else if (document.body.offsetHeight){
			wheight = document.body.offsetHeight;
			wwidth = document.body.offsetWidth;
			pageScroll = 50 + Math.max(divContent.scrollHeight, divNavigation.scrollHeight);
			pheight = Math.max(wheight, pageScroll);
		} else {
			return false;
		}
		
		// Fix transparency.
		IEPattern = /MSIE (\d+\.\d+)/;
		if (IEPattern.test(navigator.userAgent)&&IEPattern.exec(navigator.userAgent)[1]<7){
			divEdgeTop.style.background = "none";
			divEdgeBottom.style.background = "none";
			divContent.style.backgroundImage = "url(../images/background-page-top.gif)";
			liHome.style.background = "none";
			divEdgeTop.runtimeStyle.filter = "progID:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/background-edge-top.png', sizingMethod='image')";
			divEdgeBottom.runtimeStyle.filter = "progID:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/background-edge.png', sizingMethod='scale')";
			liHome.runtimeStyle.filter = "progID:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/background-menu-top.png', sizingMethod='image')";
		}
		
		// Adjust width and height.
		divScroller.style.height = wheight + "px";
		divScroller.style.width = wwidth + "px";
		divPage.style.height = (pheight - 25) + "px";
		divContainer.style.height = (pheight - 93) + "px";
		divPageBackground.style.height = (pheight - 93) + "px";
		divPageEdge.style.height = (pheight - 25) + "px";
		divEdgeBottom.style.height = (pheight - 50) + "px";
		if (wwidth < 900){
			divPage.style.left = "0";
			divPage.style.marginLeft = "0";
			divScroller.style.overflowX = "auto";
		} else {
			divPage.style.left = "50%";
			divPage.style.marginLeft = "-450px";
			divScroller.style.overflowX = "hidden";
		}
		divNavigation.style.height = (pheight - 50) + "px";
		divContent.style.height = (pheight - 143) + "px";
		return true;	
	} else {
		return false;
	}
}

// Set to readjust when window is resized.
onresize = screenSize;