/*
 * Flashdetect & write v1.0 (no cookie saving))
 * based on moockfpi
 * since our swf movies require atleast Flash 4
 * this script doesn't bother to check for lesser versions. (WEBTV)
 *
 * @author Jussi Löf / Ambientia Ltd.
 */
/* settings */
var MIN_FLASH_VERSION = 5;
var MAX_FLASH_VERSION = 8;
var DETECT_FIRST = true;
var ENABLE_MANUAL_FORCE = false;       //prompt for forcing flash
/* /settings */

var Flash = new Object();
Flash.version = 0;
for (i = MIN_FLASH_VERSION; i <=  MAX_FLASH_VERSION; i++)  eval('Flash.v'+i+'=false');
Flash.detect = function ()
{
   if (navigator.plugins)						
        if (navigator.plugins["Shockwave Flash"])   
        {		
  	        var flashDescription = navigator.plugins["Shockwave Flash"].description;
            var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
            for(i = MIN_FLASH_VERSION; i <= MAX_FLASH_VERSION; i++)
                eval('Flash.v'+i+'=flashVersion=='+i);		
        }
   if (navigator.appVersion.indexOf("MSIE") && navigator.appVersion.indexOf("Windows"))
   { 
        document.write('<SCR' + 'IPT LANGUAGE=VBScript\>\non error resume next \n');
        for(i = MIN_FLASH_VERSION; i <= MAX_FLASH_VERSION; i++)
            document.write('Flash.v'+i+' = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))) \n');
        document.write('</SCR' + 'IPT\> \n');
   }
    for (var i = MIN_FLASH_VERSION; i <= MAX_FLASH_VERSION; i++)
        if ( eval('Flash.v'+i) == true ) this.version = i;
   
    if (ENABLE_MANUAL_FORCE) /* !!force mode!! */
        if (this.version < MIN_FLASH_VERSION)
            if ( confirm("Failed to detect Flash Plugin. Try to embed Flash movies anyway?") )
                this.version = MAX_FLASH_VERSION;
    
    return 'SWF plugin version:'+this.version;
}
Flash.embed = function ( swf, _width, _height)
{
    var html = '<OBJECT type="application/x-shockwave-flash" data="'+swf+'"'+
               'WIDTH='+_width+' HEIGHT='+_height+'>' +
               '<PARAM NAME=bgcolor VALUE=#FAF8E4>'+
               '<PARAM NAME=movie VALUE="'+swf+'">' +
               '<PARAM NAME=quality VALUE=high>' +
               '<EMBED src="'+swf+'" quality=high '+
               'WIDTH='+_width+' HEIGHT='+_height+'  BGCOLOR="#FAF8E4" TYPE="application/x-shockwave-flash" '+
               'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>'+
               '</OBJECT>';
    return html;
}
Flash.write = function ( swf, _width, _height)
{
    document.write( this.embed( swf, _width, _height ) );
}

if (DETECT_FIRST) window.status = Flash.detect(); //check version now





