function WriteApplet(appletCode, appletHelpfile, appletArchive, appletWidth, appletHeight, NetEntertainmentAppletCodeBase, appletPort, appletDisableAudio, appletGameName, appletSessionId, appletCoinValue, notInstalled) {
	document.writeln('<APPLET id="gameApplet" code="' + appletCode + '" helpfile="' + appletHelpfile + '" archive="' + appletArchive + '" width="' + appletWidth + '" height="' + appletHeight + '" codebase="' + NetEntertainmentAppletCodeBase + '">');
	document.writeln('<PARAM NAME="port" VALUE="' + appletPort + '"/>');
	document.writeln('<PARAM NAME="disableaudio" VALUE="' + appletDisableAudio + '"/>');
	document.writeln('<PARAM NAME="gamename" VALUE="' + appletGameName + '"/>');
	document.writeln('<PARAM NAME="casinoServlet" VALUE="/servlet/CasinoServlet/"/>');
	if (appletSessionId != "")
		document.writeln('<PARAM NAME="SessId" VALUE="' + appletSessionId + '" />');
	if (appletCoinValue != "")
		document.writeln('<PARAM NAME="coinValue" VALUE="' + appletCoinValue + '0" />');
	document.writeln(notInstalled);
	document.writeln('</APPLET>');
}

function WriteFlashGame(base, width, height, helpfile, vars, src, scheme, baseUrl, sessionId, audio, resourceUrl) {
	if (sessionId!='')
		sessionId = 'sessid=' + sessionId + '&';
    
    if (helpfile.indexOf('blackjackmini') > 0)
        return false;

    var isFullscreen = (width == '100%' && height == '100%');

	document.writeln('<OBJECT ');
	document.writeln('classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
	document.writeln('codebase="' + scheme + '://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,42,34" ');
	document.writeln('WIDTH="' + width + '" ');
	document.writeln('HEIGHT="' + height + '" ');
	document.writeln('ALIGN="">');
	document.writeln('<PARAM NAME=movie VALUE="' + resourceUrl + src + '">');
	document.writeln('<PARAM NAME=quality VALUE=high>');
	document.writeln('<PARAM NAME=bgcolor VALUE=#FFFFFF>');
	document.write('<PARAM NAME=FlashVars VALUE="server=' + baseUrl + '/&' + sessionId + vars + '&disableAudio=' + audio);
	if (isFullscreen)
	    document.write('&fullscreen=true');
	document.writeln('">');
	document.writeln('<PARAM NAME="SCALE" VALUE="exactfit">');
	document.writeln('<PARAM NAME="BASE" value="' + base + '">');
	document.writeln('<PARAM NAME="AllowScriptAccess" value="always">');
	if (isFullscreen)
	    document.writeln('<PARAM NAME="AllowFullScreen" value="true">');
	document.writeln('<PARAM NAME="wmode" value="transparent">');
	document.writeln('<EMBED ');
	document.writeln('src="' + resourceUrl + src + '" ');
	document.writeln('quality=high ');
	document.writeln('bgcolor=#FFFFFF ');
	document.writeln('WIDTH="' + width + '" ');
	document.writeln('HEIGHT="' + height + '" ');
	document.writeln('ALIGN="" ');
	document.writeln('SCALE="exactfit" ');
	document.writeln('TYPE="application/x-shockwave-flash"  ');
	document.writeln('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" ');
	document.writeln('BASE="' + base + '" ');
	document.writeln('AllowScriptAccess="always" ');
	if (isFullscreen)
	    document.writeln('AllowFullScreen="true" ');
	document.writeln('wmode="transparent" ');
	document.write('FlashVars="server=' + baseUrl + '/&' + sessionId + vars + '&disableAudio=' + audio);
	if (isFullscreen)
	    document.write('&fullscreen=true');
	document.writeln('">');
	document.writeln('</EMBED>');
	document.writeln('</OBJECT>');
}

function WriteFlashGameFullscreen(base, helpfile, vars, src, scheme, baseUrl, sessionId, audio, resourceUrl) {
    WriteFlashGame(base, '100%', '100%', helpfile, vars, src, scheme, baseUrl, sessionId, audio, resourceUrl);
}
