/* Javascript by Klaus-dieter Michel - July/2007 */
/* http://notarianniglass.co.uk */

var DOM = 0; ALL = 0; winW = 0; winH = 0;

if(document.all){
	ALL = 1;
}
if(document.getElementById){
	DOM = 1;
}
if(document.all && document.getElementById){
	DOM = 0;
}

function detectWinSize(){
	if(DOM){
		winW = window.innerWidth;
		winH = window.innerHeight;
	} 
	if(ALL){
		winW = document.all.docBody.offsetWidth;
		winH = document.all.docBody.offsetHeight;
	}
	adjustCstage();
	checkWinSize();
}

function adjustCstage() {
	var flashW = 901;
	var flashH = 676;
	var posX = (winW/2)-(flashW/2);
	if (posX < 0) {
		posX = 0;
	}
	var posY = (winH/2)-(flashH/2)-30; 
	if (posY < 0) {
		posY = 0;
	}
	document.getElementById('flashdiv').style.left = posX;
	document.getElementById('flashdiv').style.top = posY;
}

/* permanently, each sec */
function checkWinSize() {
	var checkW = 0; checkH = 0;
	if(DOM) {
		checkW = window.innerWidth;
		checkH = window.innerHeight;
	}
	if(ALL) {
		checkW = document.all.docBody.offsetWidth;
		checkH = document.all.docBody.offsetHeight;
	}
	if(checkW != winW || checkH != winH) {
		winW = checkW;
		winH = checkH;
		adjustCstage();
	} 
	window.setTimeout("checkWinSize()", 1000);
}

