// JavaScript Document

// Let's get the height of the available window for all browsers
var BrowserType = "";
var MozMinimumHeight = 0;
var IEMinimumHeight = 0;
var IEAdjust = 182;
var MozAdjust = 178;
var WidthAdjust = 217;
var minimumHeight = IEMinimumHeight; 

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
		BrowserType="Moz";
	} else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
			BrowserType="IE";
		} else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
				BrowserType="3";
			}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
		BrowserType="Moz";
	} else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
			BrowserType="IE";
		} else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
				BrowserType="3";
			}
		}
	}
	return windowWidth;
}


function setLayout() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		var windowWidth = getWindowWidth();
		var Resize = document.getElementById('HermesFrame');
		var FrameSpace = document.getElementById("FrameSpacer");
		if (BrowserType =="IE") {
			adjust = IEAdjust;
			minimumHeight = IEMinimumHeight; 
			windowWidth = windowWidth - WidthAdjust;
			Resize.width = windowWidth + "px;";
		} else {
			adjust = MozAdjust;
			minimumHeight = MozMinimumHeight; 
			windowWidth = windowWidth - WidthAdjust;
			Resize.width = windowWidth + "px;";
		}
		if (windowHeight-adjust > minimumHeight) {
			Resize.height =(windowHeight-adjust);
			FrameSpace.height =(windowHeight-adjust);
		} else {
			Resize.height =(minimumHeight-adjust);
			FrameSpace.height =(minimumHeight-adjust);
		}
	}
}

	window.onload = function() { setLayout(); }
	window.onresize = function() { setLayout(); }

