function write_flash_to_screen(strFlashPath,numMovieWidth,numMovieHeight,strFlashVars) {
	var strFlashEmbed = '';
	strFlashEmbed += '<div id="flashContent">';
	strFlashEmbed += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+numMovieWidth+'" height="'+numMovieHeight+'" id="home_template" align="middle" viewastext>';
	strFlashEmbed += '<param name="allowScriptAccess" value="sameDomain" />';
	strFlashEmbed += '<param name="movie" value="'+strFlashPath+'?'+strFlashVars+'" />';
	strFlashEmbed += '<param name="quality" value="high" />';
	strFlashEmbed += '<param name="scale" value="noscale" />';
	strFlashEmbed += '<param name="salign" value="t" />';
	strFlashEmbed += '<param name="bgcolor" value="#ffffff" />';
	strFlashEmbed += '<embed src="'+strFlashPath+'?'+strFlashVars+'" scale="noscale" salign="t" quality="high" bgcolor="#ffffff" width="'+numMovieWidth+'" height="'+numMovieHeight+'" name="home_template" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	strFlashEmbed += '</object>';
	strFlashEmbed += '</div>';
	
	document.write(strFlashEmbed);
}

/* DETECT FLASH VERSION */

//Whether to us redirect files for upgrade, flash movie containing pages
var blnActualVersion = true;
 
var flash2Installed = false; //true if flash 2 is installed
var flash3Installed = false; //true if flash 3 is installed
var flash4Installed = false; //true if flash 4 is installed
var flash5Installed = false; //true if flash 5 is installed
var flash6Installed = false; //true if flash 6 is installed
var flash7Installed = false; //true if flash 7 is installed
var flash8Installed = false; //true if flash 8 is installed
var flash9Installed = false; //true if flash 9 is installed

var numMaxVersion = 9; //highest version we can actually detect
var numActualVersion = 0; //version the client browser has installed
var blnHasRightVersion = false; //true if it's safe to embed the flash movie in the page
var numJsVersion = 1.0; //version of javascript supported
   
//Check browser and platform for combination check later
var blnIsAOL = (navigator.appVersion.indexOf("AOL") != -1) ? true : false; //true if AOL installed, false otherwise
var blnIsIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; //true if IE intalled, false otherwise
var blnIsWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; //true if running on Windows, false otherwise
//This is a js1.1 code block, make note that js1.1 is supported
numJsVersion = 1.1;

//Vbscript detection on Windows IE. This configuration doesn't support regular javascript plugins array detection
if(blnIsIE && blnIsWin && !blnIsAOL)
{
    document.write('<scr' + 'ipt language=vbscript\> \n');
    document.write('on error resume next \n');
    document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
    document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
    document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
    document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
    document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
    document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
    document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
    document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
    document.write('<\/scr' + 'ipt\> \n');
}

function flash_detect(numRequiredVersion,strFlashPage,strNoFlashPage,strUpgradePage)
{ 
    var strFlashPage = strFlashPage; //flash page to redirect to if the necessary player is installed
    var strNoFlashPage = strNoFlashPage; //no flash alternative page to redirect to if no flash player is installed
    var strUpgradePage = strUpgradePage; //page to redirect to is flash installed but player needs upgrading to view content
    var numRequiredVersion = numRequiredVersion; //version the user needs to view movie (max 9, min 2)
 
    //Check to see if browser supports navigator.plugins
    if (navigator.plugins)
    {
        //Perform check for flash 2 or flash 3+
        if((navigator.plugins["Shockwave Flash 2.0"])||(navigator.plugins["Shockwave Flash"]))
        {
            //Version of Flash was found
            var blnIsVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
            var strFlashDescription = navigator.plugins["Shockwave Flash" + blnIsVersion2].description;
   
            //Debug : alert("Flash plugin description: " + strFlashDescription);

            //A flash plugin-description looks like this: Shockwave Flash 4.0 r5
            //We can get the major version by grabbing the character before the period note that we don't bother with minor version detection.
            //Do that in your movie with $version or getVersion().

            var numFlashVersion = parseInt(strFlashDescription.substring(16));
   
            //We found the version, now set appropriate version flags. Be sure to use >= on the highest version so future version users aren't prevented from entering the site
            flash2Installed = numFlashVersion == 2;    
            flash3Installed = numFlashVersion == 3;
            flash4Installed = numFlashVersion == 4;
            flash5Installed = numFlashVersion == 5;
            flash6Installed = numFlashVersion == 6;
            flash7Installed = numFlashVersion == 7;
            flash8Installed = numFlashVersion == 8;
            flash9Installed = numFlashVersion >= 9;
        }
    }
 
    //Loop through all versions being checking, and set numActualVersion to highest detected version
    for(numVersionCheck=2; numVersionCheck<=numMaxVersion; numVersionCheck++)
    {
        if(eval("flash" + numVersionCheck + "Installed") == true)
        {
            numActualVersion = numVersionCheck;
        }
    }

    //If being viewed on msntv (formerly webtv), the version supported is 4 (as of January 1, 2004). 
    if(navigator.userAgent.indexOf("WebTV")!=-1)
    {
        numActualVersion = 4;
    }

    //Debug : alert("version detected: " + numActualVersion);

    //If the client browser has a new enough version
    if(numActualVersion >= numRequiredVersion)
    {
        if(blnActualVersion)
        {
            if(numJsVersion > 1.0)
            {
                window.location.replace(strFlashPage);
            }
            else
            {
                window.location = strFlashPage;
            }
            blnHasRightVersion = true;
        }
    }
    else
    {
        if(blnActualVersion)
        {
            if(numJsVersion > 1.0)
            {
                window.location.replace((numActualVersion >= 2) ? strUpgradePage : strNoFlashPage);
            }
            else
            {
                window.location = (numActualVersion >= 2) ? strUpgradePage : strNoFlashPage;
            }
        }
    }
}  

