
function setSize() {

	var pageSize = this.getPageSize();
	var vpWidth = pageSize[2];
	var vpHeight = pageSize[3];

	// alert(vpWidth + " - " + vpHeight + " - " + contentHeight);

	// topnav = 30 
	// h2 = 250 (height and top margin) + 20 bottom margin = 270
	// footer = 30 + 1 top border = 31
	// TOTAL: 30 + 270 + 31 = 331
	
	// 331 is the minimum content on the page
	
	// If the viewport is larger than 331, then HEIGHTSET should be sized to make sure
	// the footer is at the bottom of the page; the size of the HEIGHTSET is viewport - 333.
	// We then add another pixel to make sure there's always a scrollbar.
	
	var contentHeight = vpHeight - 331 + 1;   

	 if (vpHeight > 331 ) {
	 	document.getElementById("heightSet").style.height = contentHeight + "px";
	 	}
	 	
	}
		
// ===============================================================================================================================

getPageSize = function() {
	var xScroll, yScroll, windowWidth, windowHeight;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = this.document.scrollWidth;
		yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);
		}
	else if (this.document.body.scrollHeight > this.document.body.offsetHeight){
		xScroll = this.document.body.scrollWidth;
		yScroll = this.document.body.scrollHeight;
		}
	else {
		xScroll = this.document.getElementsByTagName("html").item(0).offsetWidth;
		yScroll = this.document.getElementsByTagName("html").item(0).offsetHeight;
		xScroll = (xScroll < this.document.body.offsetWidth) ? this.document.body.offsetWidth : xScroll;
		yScroll = (yScroll < this.document.body.offsetHeight) ? this.document.body.offsetHeight : yScroll;
		}

	if (self.innerHeight) {
		windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
		windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
		}
	else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = this.document.documentElement.clientWidth;
		windowHeight = this.document.documentElement.clientHeight;
		}
	else if (document.body) {
		windowWidth = this.document.getElementsByTagName("html").item(0).clientWidth;
		windowHeight = this.document.getElementsByTagName("html").item(0).clientHeight;
		windowWidth = (windowWidth == 0) ? this.document.body.clientWidth : windowWidth;
		windowHeight = (windowHeight == 0) ? this.document.body.clientHeight : windowHeight;
		}

	var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
	var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
	return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
	}


	
// ===============================================================================================================================	
	
function backgroundImage() {	
	var pageSize = this.getPageSize();
	var vpWidth = pageSize[2];
	var vpHeight = pageSize[3];	
	
	document.getElementById("backgroundImage").style.width=vpWidth + "px";
	document.getElementById("backgroundImage").style.height=vpHeight + "px";
	document.getElementById("leftHeight").style.height=vpHeight + "px";
	}
	
// ===============================================================================================================================	


	
function callScripts() {
	backgroundImage();
	}
	
	
window.onload = callScripts;