function currency_alert(what) {
	// alert(what);
}

// find target flash object in frame structure
function currency_Target(cnt) {
	// in case the target is a non-empty array, check all elements
	// this code is used for Firefox, and possibly others
	try {
		var target = document['screen'];
		if(target && !(target instanceof String) && target.length && (target.length > 0))
			for(var idx=0; idx<target.length; idx++) {
				var elem = target[idx];
				if(elem && elem.SetVariable) return elem;
			}
		return target;
	}
	// we need this because of a Firefox 2 Bug returning random "cyclic __proto__ value" errors in the Error Console
	// see http://www.siteexperts.com/forums/viewConverse.asp?d_id=19737
	// if its looping excessively the browser sometimes pops up a "script is busy on this page" message
	catch(e) {
		if(e.toString().indexOf("cyclic __proto__ value") > -1)
			return currency_Target(cnt+1);
//		else	alert("OOOPS " + cnt + ", " + e);
	}

//	if there wasn't safari...
//	if(parent.game.document.embeds)
//		return document.embeds['screen'];
//	else	return document['screen'];
}

// stub versions for flash interface functions to accommodate different browsers
function currency_SetVariable(variable, value) { currency_Target(0).SetVariable(variable, value); }
function currency_GetVariable(variable) { return currency_Target(0).GetVariable(variable); }
function currency_TCallLabel(target, label) { currency_Target(0).TCallLabel(target, label); }
function currency_TGotoLabel(target, label) { currency_Target(0).TGotoLabel(target, label); }

function currency_DoFSCommand(command, args) {
	currency_alert("currency_DoFSCommand:"+command+":"+args);
	if (command=="currency" || command=="FSCommand:currency") // FSCommand: prefix is used by Safari-2.0
	{
		currency_alert("currency = "+args);
		currency_TGotoLabel("/", args);
	}
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
	navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {

	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('Sub currency_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call currency_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}

