// JavaScript Document
var flashObjectId = "flashObject";
var flashEmbedId = "flashFile";

var minMovieWidth = 660;
var minMovieHeight = 730;

function setFlashSize(width, height) {
	minMovieWidth = width;
	minMovieHeight = height;
	updateSize();
}

function pageWidth() {
	return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null;
}

function pageHeight() {
	return window.innerHeight != null? window.innerHeight: document.body != null? document.body.clientHeight:null;
}

function updateSize() {
	if (document.getElementById) {
		var flashObject = document.getElementById(flashObjectId);
		var flashEmbed = document.getElementById(flashEmbedId);
		if (pageWidth() < minMovieWidth) {
			updateFlashWidth(flashObject, flashEmbed, minMovieWidth);
		}
		else {
			updateFlashWidth(flashObject, flashEmbed, "100%");
		}
		if (pageHeight() < minMovieHeight) {
			updateFlashHeight(flashObject, flashEmbed, minMovieHeight);
		}
		else {
			updateFlashHeight(flashObject, flashEmbed, "100%");
		}
	}
}

function updateFlashWidth(flashObject, flashEmbed, newWidth) {
	flashObject.width = newWidth;
	if (flashEmbed) {
		flashEmbed.width = newWidth;
	}
}

function updateFlashHeight(flashObject, flashEmbed, newHeight) {
	flashObject.height = newHeight;
	if (flashEmbed) {
		flashEmbed.height = newHeight;
	}
}

window.onload = updateSize;
window.onresize = updateSize;
