/* main content centering code */

function centering_go() {
	var obj = document.getElementById("content");
	if (!obj) return;

	/* put it in it's place */
	obj.centerMe = function() {
		var docw = 1024;
		var doch = 768;
		var myw = 1024;
		var myh = 768;

		if (typeof( window.innerWidth ) == 'number') {
			docw = window.innerWidth;
			doch = window.innerHeight;
		}
		else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			docw = document.documentElement.clientWidth;
			doch = document.documentElement.clientHeight;
		}
		else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			docw = document.body.clientWidth;
			doch = document.body.clientHeight;
		}

		if (typeof( obj.offsetWidth) == 'number') {
			myw = obj.offsetWidth;
			myh = obj.offsetHeight;
		}

		this.style.position = "absolute";

		var nx = (docw - myw) / 2.0;
		var ny = (doch - myh) / 2.0;
		if (nx < 0) nx = 0;
		if (ny < 0) ny = 0;
		if (!document.dontCenterY)
			this.style.top = ny.toString() + "px";
		if (!document.dontCenterX)
			this.style.left = nx.toString() + "px";

		document.docWidth = docw;
		document.docHeight = doch;
	}
	obj.centerMe();
	document.onresizenotifythis = obj;
	document.onresizealsonotifythese = new Array();

	/* recieve notifications on resize */
	window.onresize = function() {
		if (typeof(document.onresizenotifythis) != 'undefined')
			document.onresizenotifythis.centerMe();

		var i;
		for (i=0;i < document.onresizealsonotifythese.length;i++) {
			var obj = document.onresizealsonotifythese[i];
			if (!obj) continue;
			if (!obj.centerMe) continue;
			obj.centerMe();
		}
	}
}

centering_go();

