	requiredMajorVersion = 10.0;
	requiredMinorVersion = 0; 
	requiredRevision = 0;

function PrintGameTag(dcr, width, height, bgcolor, sw1, sw2, sw3, sw4, sw5, sw6, sw7, sw8, sw9, swlist, version, menu) {
	if (!(sw1)) { sw1 = ""; }
	if (!(sw2)) { sw2 = ""; }
	if (!(sw3)) { sw3 = ""; }
	if (!(sw4)) { sw4 = ""; }
	if (!(sw5)) { sw5 = ""; }
	if (!(sw6)) { sw6 = ""; }
	if (!(sw7)) { sw7 = ""; }
	if (!(sw8)) { sw8 = ""; }
	if (!(sw9)) { sw9 = ""; }
	if (!(swlist)) { swlist = ""; }

	document.write('   <OBJECT CLASSID="clsid:166B1BCA-3F9C-11CF-8075-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=' + version + '" WIDTH="' + width + '" HEIGHT="' + height + '">	');
	document.write('   <PARAM NAME="SRC" VALUE="' + dcr + '">	');
	document.write('   <param name="swStretchStyle" value="meet">   ');
	document.write('   <PARAM NAME="BGCOLOR" VALUE="' + bgcolor + '">	');
	document.write('   <PARAM NAME="SW1" VALUE="' + sw1 + '">	');
	document.write('   <PARAM NAME="SW2" VALUE="' + sw2 + '">	');
	document.write('   <PARAM NAME="SW3" VALUE="' + sw3 + '">	');
	document.write('   <PARAM NAME="SW4" VALUE="' + sw4 + '">	');
	document.write('   <PARAM NAME="SW5" VALUE="' + sw5 + '">	');
	document.write('   <PARAM NAME="SW6" VALUE="' + sw6 + '">	');
	document.write('   <PARAM NAME="SW7" VALUE="' + sw7 + '">	');
	document.write('   <PARAM NAME="SW8" VALUE="' + sw8 + '">	');
	document.write('   <PARAM NAME="SW9" VALUE="' + sw9 + '">	');
	document.write('   <PARAM NAME="SWLIST" VALUE="' + swlist + '">	');

	//if (menu == 0) {
		document.write('   <PARAM NAME="SWREMOTE" VALUE="swSaveEnabled=\'false\' swVolume=\'false\' swRestart=\'false\' swPausePlay=\'false\' swFastForward=\'false\' swContextMenu=\'false\'">	');
		document.write('   <EMBED SRC="' + dcr + '" WIDTH="' + width + '" HEIGHT="' + height + '"  BGCOLOR="' + bgcolor + '" SW1="' + sw1 + '" SW2="' + sw2 + '" SW3="' + sw3 + '" SW4="' + sw4 + '" SW5="' + sw5 + '" SW6="' + sw6 + '" SW7="' + sw7 + '" SW8="' + sw8 + '" SW9="' + sw9 + '" SWLIST="' + swlist + '"swStretchStyle=\'meet\'  SWREMOTE="swSaveEnabled=\'false\' swVolume=\'false\' swRestart=\'false\' swPausePlay=\'false\' swFastForward=\'false\' swContextMenu=\'false\'" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveDirector" PALETTE="background"></EMBED>	');
	//} else {
	//	document.write('   <PARAM NAME="SWREMOTE" VALUE="swSaveEnabled=\'false\' swVolume=\'false\' swRestart=\'false\' swPausePlay=\'false\' swFastForward=\'false\' swContextMenu=\'false\'">	');
	//	document.write('   <EMBED SRC="' + dcr + '" WIDTH="' + width + '" HEIGHT="' + height + '"  BGCOLOR="' + bgcolor + '" SW1="' + sw1 + '" SW2="' + sw2 + '" SW3="' + sw3 + '" SW4="' + sw4 + '" SW5="' + sw5 + '" SW6="' + sw6 + '" SW7="' + sw7 + '" SW8="' + sw8 + '" SW9="' + sw9 + '" SWLIST="' + swlist + '"swStretchStyle=\'meet\' SWREMOTE="swSaveEnabled=\'false\' swVolume=\'false\' swRestart=\'false\' swPausePlay=\'false\' swFastForward=\'false\' swContextMenu=\'false\'" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveDirector" PALETTE="background"></EMBED>	');
	//}
	document.write('   </OBJECT>	');
}

function PrintFlashGameTagNow(swf, width, height, bgcolor, session_id, sw1, sw2, sw3, sw4, sw5, sw6, sw7, sw8, sw9, swlist, version, menu, qs, baseUrl) {
	if (!(sw1)) { sw1 = ""; }
	if (!(sw2)) { sw2 = ""; }
	if (!(sw3)) { sw3 = ""; }
	if (!(sw4)) { sw4 = ""; }
	if (!(sw5)) { sw5 = ""; }
	if (!(sw6)) { sw6 = ""; }
	if (!(sw7)) { sw7 = ""; }
	if (!(sw8)) { sw8 = ""; }
	if (!(sw9)) { sw9 = ""; }
	if (!(swlist)) { swlist = ""; }

	param = "&session_id="+session_id+"&sw1="+sw1+"&sw2="+sw2+"&sw3="+sw3+"&sw4="+sw4+"&sw5="+sw5+"&sw6="+sw6+"&sw7="+sw7+"&sw8=&sw9="+sw9+"&swlist="+swlist;
	document.write(' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"'+' WIDTH="'+width+'" HEIGHT="'+height+'"> ');
	document.write(' <PARAM NAME="SRC" VALUE="'+swf+'"> ');
	document.write(' <PARAM NAME="BGCOLOR" VALUE="'+bgcolor+'"> ');
	document.write('   <PARAM NAME="BASE" VALUE="'+baseUrl+'">');
	document.write(' <PARAM NAME="FlashVars" VALUE="swmumbo='+String(sw4)+param+'">	');
	document.write(' <param name="quality" value="high" />');
	document.write(' <PARAM name="allowScriptAccess" value="sameDomain" />');
	//if (menu == 0) {
		document.write(' <PARAM name="Menu" value="false"> ');
		document.write(' <EMBED menu="false" SRC="'+swf+'" FlashVars="swmumbo='+String(sw4)+param+'" WIDTH="'+width+'" HEIGHT="'+height+'"  BGCOLOR="'+bgcolor+'" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" BASE="'+baseUrl+'"></EMBED> ');
	//} else {
		//document.write(' <PARAM name="Menu" value="true">');
		//document.write(' <EMBED menu="true"  SRC="'+swf+'" FlashVars="swmumbo='+String(sw4)+param+'" WIDTH="'+width+'" HEIGHT="'+height+'"  BGCOLOR="'+bgcolor+'" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" BASE="'+baseUrl+'"></EMBED> ');
	//}
	document.write('   </OBJECT> ');
}

function writeFlashTag(movie, width, height, bgcolor, name, paramstring, baseUrl)
{
	
	requiredMinorVersion = 0;
	requiredRevision = 0;
	jsVersion = 1.0;
	
	flashMovie = movie;
	flashWidth = width;
	flashHeight = height;
	flashBgcolor = bgcolor;
	flashName = name;
	flashParamstring = paramstring;
	
	isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
	isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
	jsVersion = 1.1;
	
	hasProductInstall = DetectFlashVer(6, 0, 65);
	hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	MMredirectURL = window.location;
	if(hasProductInstall && !hasReqestedVersion)
	{
		writeFlashUpgrade(width, height, bgcolor, movie);
	}
	else if(hasReqestedVersion)
	{
		writeFlashTagNow(movie, width, height, bgcolor, name, paramstring, baseUrl); 
	}
	else
	{  // flash is too old or we can't detect the plugin
	    writeNoFlash(width, height, movie);
	}
}

function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) 
{
	
 	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
   	// loop backwards through the versions until we find the newest version	
	for (i=25;i>0;i--) {	
		if (isIE && isWin && !isOpera) {
			versionStr = VBGetSwfVer(i);
		} else {
			versionStr = JSGetSwfVer(i);		
		}
		if (versionStr == -1 ) { 
			return false;
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				tempArray         = versionStr.split(" ");
				tempString        = tempArray[1];
				versionArray      = tempString .split(",");				
			} else {
				versionArray      = versionStr.split(".");
			}
			versionMajor      = versionArray[0];
			versionMinor      = versionArray[1];
			versionRevision   = versionArray[2];
			
			versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			versionNum        = parseFloat(versionString);
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
			}
		}
	}	
	return (reqVer ? false : 0.0);
}

function JSGetSwfVer(i)
{
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
      		versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      	} else {
			flashVer = -1;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		
		flashVer = -1;
	}
	return flashVer;
} 