var TITLE_WIDTH = 0;
var GAME_WIDTH = 1024;
var GAME_HEIGHT = 768;
var TOP_OFFSET = 50;
var MIN_BORDER = 0;

function placeContent(){
	var windowWidth = getWindowWidth();
	var windowHeight = getWindowHeight();

	//document.getElementById("widthField").value = windowWidth;
	//document.getElementById("heightField").value = windowHeight;

	if (windowWidth <= 0 || windowHeight <= 0) {
		alert("Error: Invalid Window Size\nWindowWidth = " 
		+ windowWidth + "\nWindowHeight = " + windowHeight);
	}

	var mainTable = document.getElementById("stage");

	var mainWidth = (windowWidth < GAME_WIDTH) ? GAME_WIDTH : windowWidth;
	var mainHeight = (GAME_HEIGHT);
	var mainLeft = ((windowWidth - mainWidth) / 2);
	var mainTop = TOP_OFFSET;
	
	mainTable.style.left = mainLeft + "px";
	mainTable.style.top = mainTop + "px";
	mainTable.style.width = mainWidth + "px";
	mainTable.style.height = mainHeight + "px";
	
}
	
function getWindowWidth(){
	var winW = -1;
	if (self.innerWidth) {
		//Firefox/Safari/Opera/Chrome
		winW = self.innerWidth;
	} else if (document.body && document.body.clientWidth) {
		//IE 6.0 document size (XP SP3)
		winW = document.body.clientWidth;
	}
	return winW
}
function getWindowHeight(){
	var winH = -1;
	if (self.innerHeight) {
		//Firefox/Safari/Opera/Chrome
		winH = self.innerHeight;
	} else if (document.body && document.body.clientHeight) {
		//IE 6.0 document size (XP SP3)
		winH = document.body.clientHeight;
	}
	return winH;
}
