// measure page width and height (the viewable canvas area)
divEverythingName = "divEverything";

function getCanvas() {
	if (document.width) this.w = document.width;
	else if (document.documentElement && document.documentElement.clientWidth) this.w = document.documentElement.clientWidth;
	else if (document.body && document.body.clientWidth) this.w = document.body.clientWidth;
	else if (window.innerWidth) this.w = window.innerWidth;
	else this.w = 0;

	if (document.height) this.h = document.height;
	else if (document.documentElement && document.documentElement.clientHeight) this.h = document.documentElement.clientHeight;
	else if (document.body && document.body.clientHeight) this.h = document.body.clientHeight;
	else if (window.innerHeight) this.h = window.innerHeight;
	else this.h = 0;
	return this;
}

//function to let you centre the main content div
function setCanvas() {
	canvas = new getCanvas();
	//var canvasLeft = (canvas.w - document.getElementById(divEverythingName).offsetWidth) / 2;
	//var canvasTop = (canvas.h - document.getElementById(divEverythingName).offsetHeight) / 3;
	
	var canvasLeft = (canvas.w - 796) / 2;
	var canvasTop = (canvas.h - 506) / 2.2;
	
	if (canvasLeft < 0) canvasLeft = 0;
	if (canvasTop < 0) canvasTop = 0;
	
	document.getElementById(divEverythingName).style.left = canvasLeft + "px";
	document.getElementById(divEverythingName).style.top = canvasTop + "px";
}

// function to centre and setup the div in the centre of the page
function redrawCanvas(){
	// Position the canvas div
	setCanvas();
	window.onresize = setCanvas;
}
	
	
	
	
