// keeps content centered while preventing cropping errors at low resolutions (thanks Matt!)

function checkPosition() {
	if(window.innerHeight) {
		if(window.innerHeight > flashH) {
			position("vert", true);
		} else {
			position("vert", false);
		}
		if(window.innerWidth > flashW) {
			position("horz", true);
		} else {
			position("horz", false);
		}
	} else {
		if(document.getElementById('html').clientHeight > flashH) {
			position("vert", true);
		} else {
			position("vert", false);
		}
		if(document.getElementById('html').clientWidth > flashW) {
			position("horz", true);
		} else {
			position("horz", false);
		}
	}
}

function position(dir, center) {
	var flashObj = document.getElementById('flashObject');
	if (dir == "vert") {
		if (center == true) {
			flashObj.style.marginTop = (-flashH/2)+"px";
			flashObj.style.top = "50%";
		} else {
			flashObj.style.marginTop = "0";
			flashObj.style.top = "0";
		}
	} else {
		if (center == true) {
			flashObj.style.marginLeft = (-flashW/2)+"px";
			flashObj.style.left = "50%";
		} else {
			flashObj.style.marginLeft = "0";
			flashObj.style.left = "0";
		}	
	}
}

function fillScreen() {
	window.moveTo(0, 0);
	window.resizeTo(screen.availWidth, screen.availHeight);
}

window.onload = fillScreen;
//window.onload = checkPosition;
window.onresize = checkPosition;

