
/* define the path where the flash files are kept */
var path = "resources/flash/";

/* return the flash object in IE or NN */
function getObj (whatObj) {
	var IE = navigator.appName.indexOf("microsoft") != -1;
	if (IE)	{
		return window[whatObj];
	} else {
		return window.document[whatObj];
	}			
}

function enableButton() {	
	document.getElementById("SaveFlash").disabled = false;		
	return true;
}

function disableButton() {
	document.getElementById("SaveFlash").disabled = true;
	return true;	
}

	
function writeFlash(filename, width, height)
{
	document.write('<OBJECT id=flash ' +
		'codeBase=https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 ' +
		'height=' + height + ' width=' + width + ' classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>' +		
		'<PARAM NAME="Movie" VALUE="' + path + filename + '?Browser=InternetExplorer">' +		
		'<PARAM NAME="Play" VALUE="false">' +
		'<PARAM NAME="Loop" VALUE="false">' + 
		'<param name="base" value="." />' +
		'<PARAM NAME="Quality" VALUE="High">' +	
		'<PARAM NAME="Menu" VALUE="false">' +	
		'<PARAM NAME="allowFullScreen" VALUE="true" />' +
		'<PARAM NAME="AllowScriptAccess" VALUE="always">' +			
		'<PARAM NAME="SeamlessTabbing" VALUE="false">' +
		'<PARAM NAME=FlashVars VALUE="initialURL='+ escape(document.location) + '" ' +
		'<embed name="flash" src="' + path + filename + '?Browser=Firefox" quality="high" allowFullScreen="true" base="." ' + 
		'Flashvars="initialURL='+ escape(document.location) + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" ' +
		'width="' + width + '" height="' + height + '"></embed>' +
		'</OBJECT>' +
		'<script>window.flash = document.getElementById("flash");</script>');		
		// see http://www.adobe.com/go/kb400730 for explanation of last line.
}

// this method means that the new onload doesn't overwrite any previous events
var oldEvt = window.onload;
window.onload = function() {
	if (oldEvt) oldEvt();
	setJavascriptReady();
}

// firefox
window.onpageshow = setJavascriptReady;

var javascriptReady = false;
var SWFReady = false;

function setJavascriptReady() 
{					
	javascriptReady = true;	
}
	
function isJavascriptReady() 
{			
	return javascriptReady;
}

function setSWFReady()
{	
	SWFReady = true;			
	return true;
}
