function init() {
	f_content = document.getElementById("div_flashContent");
	//alert("Initialise page");
	f_content.innerHTML = '<h1>Flash loaded successfully</h1>';
	insertFlash(f_content);
	resize(f_content);
}

function resize(obj) {
	var min_w = '990'; // set flash minimum width
	var min_h = '580'; // set flash minimum height
	
	var w_height = (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight; // window height
	var w_width = (document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth; // window width
	var f_content = document.getElementById("div_flashContent");
	var f_obj = flashObj();
	var new_height = w_height;
	
	flash_w = (w_width<=min_w) ? min_w+'px' : '100%';
	flash_h = (w_height<=min_h) ? min_h+'px' : new_height+"px"; // IE does not handle 100% well so force physical height to match container
	
	f_content.style.height = new_height+"px"; // resize flash containing div
	f_obj.style.height = flash_h; // resize flash object
	f_obj.style.width = flash_w; // resize flash object
}

function flashObj() {
		obj = document.getElementById("f_obj");
		emb = document.getElementById("f_emb");
		if (navigator.appName.indexOf("Microsoft") != -1) {
			return obj; // for IE
		} else {
			return emb; // for FF
		}
}

function insertFlash(obj) {
	//flashFile = "flash/seriousScaled.swf";
	flashFile = "site.swf";
	quality = "high";
	scale = "noscale";
	flashVars = fv;
	//scale = "default";
	flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="100%" height="100%" id="f_obj"><param name="movie" value="'+flashFile+'" /><param name="quality" value="'+quality+'" /><param name="menu" value="true" /><param name="scale" value="'+scale+'" /><param name="allowScriptAccess" value="always" /><param name="swliveconnect" value="true" /><param name="flashVars" value="'+flashVars+'" /><embed src="'+flashFile+'" id="f_emb" quality="'+quality+'" menu="true" scale="'+scale+'" allowScriptAccess="always" swliveconnect="true" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100%" height="100%" flashVars="'+flashVars+'"></embed></object>';
	obj.innerHTML = flash;
}

function jsAlert(txt) { // can be called from the Flash to output a JavaScript alert
	alert(txt);
}

<!-- DETECT FLASH
var MM_contentVersion = 9;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i) {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}
//-->
if(!MM_FlashCanPlay) { // FLASH 9 IS NOT INSTALLED
	var answer = confirm("Oops, Flash 9 seems to be unavailable\n\nClick OK to try our HTML site\nClick CANCEL to try your luck loading the Flash (it may not work!)");
	if(answer) {
		curURL = window.location.href;
		curPage = window.location.pathname;
		curPage = curPage.substring(curPage.lastIndexOf('/') + 1);
		host = curURL.replace(curPage,'');
		host = host.replace('?site=flash','');
		host += (host.charAt(host.length-1)!='/') ? '/' : '';
		newURL = host+'index.php?site=static';
		window.location = newURL;
	} else {
		// forced Flash to play
		if(window.addEventListener) window.addEventListener("load", init, false); // for non IE browsers
		else if(window.attachEvent) window.attachEvent("onload", init);			 // for IE
	}
} else {
	if(window.addEventListener) window.addEventListener("load", init, false); // for non IE browsers
	else if(window.attachEvent) window.attachEvent("onload", init);			 // for IE	
}
