function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function getWindowWidth(){
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	}
	else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		}
		else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}
	
		
function setHeight(){
	
	var windowHeight = getWindowHeight();
	//var contentHeight = document.getElementById('contentcontainer').offsetHeight;
	var contentHeight = 0;
	var contentLeftHeight = document.getElementById('contentleft').offsetHeight;
	if( store ){
		var contentCenterHeight = document.getElementById('contentstore').offsetHeight;
		var contentRightHeight = 0;
	}else{
		var contentCenterHeight = document.getElementById('contentcenter').offsetHeight;
		var contentRightHeight = document.getElementById('contentright').offsetHeight;
	}
	
	if( (contentLeftHeight >= contentCenterHeight) && (contentLeftHeight >= contentRightHeight) ){
		contentHeight = contentLeftHeight;
	}else if( (contentCenterHeight >= contentLeftHeight) && (contentCenterHeight >= contentRightHeight) ){
		contentHeight = contentCenterHeight;
	}else{
		contentHeight = contentRightHeight;
	}
	//+ value is the header height.
	contentHeight = contentHeight + 250;
	
	var bg = document.getElementById('bg');
	var leftBorder = document.getElementById('bgl');
	var rightBorder = document.getElementById('bgr');
	var bottomBorder = document.getElementById('bgbot');
	var contentright = document.getElementById('contentright');
	var vlineleft = document.getElementById('vlinel');
	var vlineright = document.getElementById('vliner');
	var footer = document.getElementById('footer');
	
	//var vlinesub = document.getElementById
	//var vlinesub = 103 + 17;
	
	//how far to hold back vertical partition lines.
	var vlinesub = 250 + 7;
	
	if( islowie ){
		if( windowHeight > contentHeight ){
			bg.style.height = windowHeight - 36 + "px";
			leftBorder.style.height = windowHeight + "px";
			rightBorder.style.height = windowHeight + "px";
			bottomBorder.style.bottom = 0;
			vlineleft.style.height = windowHeight - 36 - vlinesub +"px";
			vlineright.style.height = windowHeight - 36 - vlinesub + "px";
			footer.style.top = windowHeight - 36 + "px";
		}else{		
			//alert("ie");
			bg.style.height = contentHeight + 18 + "px";
			leftBorder.style.height = contentHeight + 36 + "px";
			rightBorder.style.height = contentHeight + 36 + "px";
			//bottomBorder.style.bottom = windowHeight - contentHeight - 40 + "px";	
			bottomBorder.style.bottom = "";
			bottomBorder.style.top = contentHeight + 36 + "px";
			vlineleft.style.height = contentHeight + 18 - vlinesub + "px";
			vlineright.style.height = contentHeight + 18 - vlinesub + "px";
			footer.style.top = contentHeight + 18 + "px";
		}
		contentright.style.right = "17px";
	}else{
		if( windowHeight > contentHeight ){
			
			bg.style.height = windowHeight - 36 + "px";
			leftBorder.style.height = windowHeight + "px";
			rightBorder.style.height = windowHeight + "px";
			bottomBorder.style.bottom = 0;
			vlineleft.style.height = windowHeight - 36 - vlinesub + "px";
			vlineright.style.height = windowHeight - 36 - vlinesub + "px";
			footer.style.top = windowHeight - 36 + "px";
		}else{
			bg.style.height = contentHeight + "px";
			leftBorder.style.height = contentHeight + 36 + "px";
			rightBorder.style.height = contentHeight + 36 + "px";
			bottomBorder.style.bottom = windowHeight - contentHeight - 36 + "px";
			vlineleft.style.height = contentHeight - vlinesub + "px";
			vlineright.style.height = contentHeight - vlinesub + "px";
			footer.style.top = contentHeight + "px";
		}
	}
}

function setWidth(){
	var minWidth = 732;
	//alert( getWindowWidth() );
	
	var bgContainer = document.getElementById("bgcontainer");
	var bgTop = document.getElementById("bgtop");
	var bgBot = document.getElementById("bgbot");
	var bgr = document.getElementById("bgr");
	var footer = document.getElementById("footer");
	
	if( minWidth > getWindowWidth() ){
		bgContainer.style.width = minWidth + "px";
		bgTop.style.width = minWidth + "px";
		bgBot.style.width = minWidth + "px";
		bgr.style.right = "";
		footer.style.width = minWidth + "px";
		if( islowie ){
			bgr.style.left = (minWidth - 17) + "px";
		}else{
			bgr.style.left = (minWidth - 16) + "px";
		}
	}else{
		bgContainer.style.width = "100%";
		bgTop.style.width = "100%";
		bgBot.style.width = "100%";
		bgr.style.left = "";
		bgr.style.right = "0";
		footer.style.width = "100%";
	}
}
	
window.onload = function() {
	setHeight();
	setWidth();
}
window.onresize = function() {
	setHeight();
	setWidth();
}
