function getObject(objectId) {
	if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId);
	} else if (document.all && document.all(objectId)) {
		return document.all(objectId);
	}
	return false;
}

function getStyleObject(objectId) {
	if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId).style;
	} else if (document.all && document.all(objectId)) {
		return document.all(objectId).style;
	} else if (document.layers && document.layers[objectId]) {
		return document.layers[objectId];
	}
	return false;
} 

function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	} else {
		if (document.documentElement&&document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth=0;
	if (typeof(window.innerWidth)=='number') {
		windowWidth=window.innerWidth;
	} else {
		if (document.documentElement&&document.documentElement.clientWidth) {
			windowWidth=document.documentElement.clientWidth;
		} else {
			if (document.body&&document.body.clientWidth) {
				windowWidth=document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

function writeFlashObject()
{
	var sFile = "main.swf";
	if ( navigator.userAgent.toLowerCase().indexOf("nintendo wii") >= 0 )
	{
		sFile = "wii_main.swf";
	}
	
	document.write( "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' id='flash_object'\n" +
	"codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'\n" +
	"id='frame' ALIGN='' STYLE='width:990px;height:660px;'>\n" +
	"<PARAM NAME='movie' VALUE='" + sFile + "'> \n" +
	"<PARAM NAME='quality' VALUE='high'> \n" +
	"<PARAM NAME='menu' VALUE='false'>\n" +
	"<PARAM NAME='bgcolor' VALUE='#FBFCFE'> \n" +
	"<EMBED src='" + sFile + "' \n" +
	"		id='flash_object'\n" +
	"		name='flash_object'\n" +
	"		menu='false' \n" +
	"		quality='high' \n" +
	"		bgcolor='#FBFCFE'  \n" +
	"		ALIGN=''		\n" +
	"		swfLiveConnect='true'\n" +
	"		TYPE='application/x-shockwave-flash' \n" +
	"		STYLE='width:990px;height:660px;'\n" +
	"		PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED>\n" +
	"</OBJECT>");

	resizeFlash();
}

function getFlashObj(movie){
   if (window.document[movie]) {
      return window.document[movie];
   }
   if (navigator.appName.indexOf("Microsoft Internet")==-1) {
      if (document.embeds && document.embeds[movie]) {
         return document.embeds[movie]; 
      }
   } else {
      return document.getElementById(movie);
   }
}

function resizeFlash()
{
	//var flashObject = getObject( "flash_object" );
	var windowHeight = getWindowHeight() - 93;
	if ( windowHeight < 660 )
	{
		windowHeight = 660;
	}
	var windowWidth = getWindowWidth();
	if ( windowWidth < 990 )
	{
		windowWidth = 990;
	}
	//flashObject.height = windowHeight - 150;
	//flashObject.height = windowHeight;
	//flashObject.width = windowWidth;


	//var flashStyleObject = getStyleObject( "flash_object" );
	//flashObject.height = windowHeight - 150;
	//flashStyleObject.height = windowHeight + "px";
	//flashStyleObject.width = windowWidth + "px";

	//alert("window height is " + windowHeight + " flash height is " + flashObject.height);

	var flashObj = getFlashObj("flash_object");
	flashObj.style.height = windowHeight + "px";
	flashObj.style.width = windowWidth + "px";

}