
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;

function CardDetectFlash() {
    var flashDetector = new FlashDetector();
    var hasProductInstall = flashDetector.testFor(6, 0, 65);
    // Version check based upon the values entered above in "Globals"
    var hasReqestedVersion = flashDetector.testFor(requiredMajorVersion, requiredMinorVersion, requiredRevision);

    if (hasProductInstall && !hasReqestedVersion) {
        // Stored value of document title used by the installation process to close the window that started the installation process
        // This is necessary to remove browser windows that will still be utilizing the older version of the player after installation is complete
        // DO NOT MODIFY THE FOLLOWING TWO LINES
        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
        var MMdoctitle = document.title;
        // Location visited after installation is complete if installation is required
        var MMredirectURL = window.location;

        window._flashConst_Width = CardFlashWidth;
        window._flashConst_Height = CardFlashHeight;
        window._flashConst_Path = CardFlashRootUrl + '/playerProductInstall.swf';
        window._flashConst_Version = "6,0,65,0";
        window._flashConst_BgColor = "#3A6EA5";
        window._flashConst_Name = 'detectiontest'
        window._flashConst_FlashVars = 'MMredirectURL=' + MMredirectURL + '&amp;MMplayerType=ActiveX&amp;MMdoctitle=' + MMdoctitle;

    } else if (hasReqestedVersion) {

        window._flashConst_Width = CardFlashWidth;
        window._flashConst_Height = CardFlashHeight;
        window._flashConst_Path = CardFlashPreviewUrl;
        window._flashConst_Version = "8,0,0,0";
        window.SD_Flash_BgColor = "#FFFFFF";
        
        if(typeof productAssetUrl != 'undefined')
            window._flashConst_Base = productAssetUrl;
        if (typeof flashBuilderBgColour != 'undefined')
            window._flashConst_BgColor = flashBuilderBgColour; //Added to set background colour to white foe M&S
        if (typeof imageMinimumRes != 'undefined')
            window._flashConst_ResTolerance = imageMinimumRes;
            
        window._flashConst_FlashVars = CardFlashPreviewParams;
    } else {  // flash is too old or we can't detect the plugin
        var alternateContent = 'This content requires the Macromedia Flash Player.'
		+ '<a href="http://www.macromedia.com/go/getflash/">Get Flash</a>';
        document.write(alternateContent);  // insert non-flash content
    }

    window._flashConst_Show = (hasProductInstall || hasReqestedVersion);
    window._flashConst_IsSsl = (document.location.href.indexOf("https") === 0);
    window._flashConst_Protocol = (window._flashConst_IsSsl) ? "https" : "http";
    window._flashConst_HasPlayedIE = 0;
    if (typeof (window._flashConst_Width) == "undefined") { window._flashConst_Width = CardFlashWidth; }
    if (typeof (window._flashConst_Height) == "undefined") { window._flashConst_Height = CardFlashHeight; }
    if (typeof (window._flashConst_Path) == "undefined") { window._flashConst_Path = "flash.swf"; }
    if (typeof (window._flashConst_Id) == "undefined") { window._flashConst_Id = "builderSwf"; } //window._flashConst_Path.split(" ").join("").split("-").join("").split(".").join(""); }
    if (typeof (window._flashConst_Name) == "undefined") { window._flashConst_Name = window._flashConst_Id; }
    if (typeof (window._flashConst_Version) == "undefined") { window._flashConst_Version = "6,0,0,0"; }
    if (typeof (window._flashConst_FlashVars) == "undefined") { window._flashConst_FlashVars = ""; }
    if (typeof (window._flashConst_ParamTags) == "undefined") { window._flashConst_ParamTags = ""; }
    if (typeof (window._flashConst_EmbedAttributes) == "undefined") { window._flashConst_EmbedAttributes = ""; }
    if (typeof (window._flashConst_BgColor) == "undefined") { window._flashConst_BgColor = "#F1FEFF"; }
    if (typeof (window._flashConst_WMode) == "undefined") { window._flashConst_WMode = "opaque"; }
    if (typeof (window._flashConst_Menu) == "undefined") { window._flashConst_Menu = "false"; }
    if (typeof (window._flashConst_Base) == "undefined") { window._flashConst_Base = "."; }
    if (typeof (window._flashConst_AllowScriptAccess) == "undefined") { window._flashConst_AllowScriptAccess = "always"; }
    if (typeof (window._flashConst_Quality) == "undefined") { window._flashConst_Quality = "high"; }
    if (typeof (window._flashConst_Play) == "undefined") { window._flashConst_Play = "true"; }
    if (typeof (window._flashConst_Loop) == "undefined") { window._flashConst_Loop = "false"; }
    if (typeof (window._flashConst_Align) == "undefined") { window._flashConst_Align = "middle"; }
    if (typeof (window._flashConst_Show) == "undefined") { window._flashConst_Show = 1; }
    if (typeof (window._flashConst_ResTolerance) == "undefined") { window._flashConst_ResTolerance = 1.4; }
}
function CardEmbedFlash2() {

    if (window._flashConst_Show && !window._flashConst_HasPlayedIE) {

        var str = '<embed'
        + ' width="' + window._flashConst_Width + '"'
        + ' height="' + window._flashConst_Height + '"'
        + ' align="' + window._flashConst_Align + '"'
        + ' id="' + window._flashConst_Id + '"'
        + ' name="' + window._flashConst_Name + '"'
        + ' flashvars="' + window._flashConst_FlashVars + '"'
        + ' src="' + window._flashConst_Path + '"'
        + ' menu="' + window._flashConst_Menu + '"'
        + ' bgcolor="' + window._flashConst_BgColor + '"'
        + ' wmode="' + window._flashConst_WMode + '"'
        + ' base="' + window._flashConst_Base + '"'
        + ' play="' + window._flashConst_Play + '"'
        + ' resTolerance="' + window._flashConst_ResTolerance + '"'
        + ' loop="' + window._flashConst_Loop + '"'
        + ' quality="' + window._flashConst_Quality + '"'
        + ' allowScriptAccess="' + window._flashConst_AllowScriptAccess + '"'
        + ' type="application/x-shockwave-flash" '
        + window._flashConst_EmbedAttributes
        + ' pluginspage="' + window._flashConst_Protocol + '://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
        + '</embed>';

        
      document.getElementById("flashPreview").innerHTML = str;
      

    }
}



function CardEmbedFlash() {
    if (window._flashConst_Show && !window._flashConst_HasPlayedIE) {
        document.write('<embed');
        document.write(' width="' + window._flashConst_Width + '"');
        document.write(' height="' + window._flashConst_Height + '"');
        document.write(' align="' + window._flashConst_Align + '"');
        document.write(' id="' + window._flashConst_Id + '"');
        document.write(' name="' + window._flashConst_Name + '"');
        document.write(' flashvars="' + window._flashConst_FlashVars + '"');
        document.write(' src="' + window._flashConst_Path + '"');
        document.write(' menu="' + window._flashConst_Menu + '"');
        document.write(' bgcolor="' + window._flashConst_BgColor + '"');
        document.write(' wmode="' + window._flashConst_WMode + '"');
        document.write(' base="' + window._flashConst_Base + '"');
        document.write(' resTolerance="' + window._flashConst_ResTolerance + '"');
        document.write(' play="' + window._flashConst_Play + '"');
        document.write(' loop="' + window._flashConst_Loop + '"');
        document.write(' quality="' + window._flashConst_Quality + '"');
        document.write(' allowScriptAccess="' + window._flashConst_AllowScriptAccess + '"');
        document.write(' type="application/x-shockwave-flash" ');
        document.write(window._flashConst_EmbedAttributes);
        document.write(' pluginspage="' + window._flashConst_Protocol + '://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
        document.write('</embed>');
    }
}
function LanguageDetectFlash() {
    var flashDetector = new FlashDetector();
    var hasProductInstall = flashDetector.testFor(6, 0, 65);
    // Version check based upon the values entered above in "Globals"
    var hasReqestedVersion = flashDetector.testFor(requiredMajorVersion, requiredMinorVersion, requiredRevision);

    if (hasProductInstall && !hasReqestedVersion) {
        // Stored value of document title used by the installation process to close the window that started the installation process
        // This is necessary to remove browser windows that will still be utilizing the older version of the player after installation is complete
        // DO NOT MODIFY THE FOLLOWING TWO LINES
        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
        var MMdoctitle = document.title;
        // Location visited after installation is complete if installation is required
        var MMredirectURL = window.location;

        window._flashConst_Width = LanguageFlashWidth;
        window._flashConst_Height = LanguageFlashHeight;
        window._flashConst_Path = LanguageFlashRootUrl + '/playerProductInstall.swf';
        window._flashConst_Version = "6,0,65,0";
        window._flashConst_BgColor = "#3A6EA5";
        window._flashConst_Name = 'detectiontest'
        window._flashConst_FlashVars = 'MMredirectURL=' + MMredirectURL + '&amp;MMplayerType=ActiveX&amp;MMdoctitle=' + MMdoctitle;

    } else if (hasReqestedVersion) {

        window._flashConst_Width = LanguageFlashWidth;
        window._flashConst_Height = LanguageFlashHeight;
        window._flashConst_Path = LanguageFlashUrl;
        window._flashConst_Version = "8,0,0,0";
        window.SD_Flash_BgColor = "#FFFFFF";
        window._flashConst_FlashVars = LanguageFlashParams;
        if (typeof imageMinimumRes != 'undefined')
            window._flashConst_ResTolerance = imageMinimumRes;
    } else {  // flash is too old or we can't detect the plugin
        var alternateContent = 'This content requires the Macromedia Flash Player.'
		+ '<a href="http://www.macromedia.com/go/getflash/">Get Flash</a>';
        document.write(alternateContent);  // insert non-flash content
    }

    window._flashConst_Show = (hasProductInstall || hasReqestedVersion);
    window._flashConst_IsSsl = (document.location.href.indexOf("https") === 0);
    window._flashConst_Protocol = (window._flashConst_IsSsl) ? "https" : "http";
    window._flashConst_HasPlayedIE = 0;
    if (typeof (window._flashConst_Width) == "undefined") { window._flashConst_Width = LanguageFlashWidth; }
    if (typeof (window._flashConst_Height) == "undefined") { window._flashConst_Height = LanguageFlashHeight; }
    if (typeof (window._flashConst_Path) == "undefined") { window._flashConst_Path = "flash.swf"; }
    if (typeof (window._flashConst_Id) == "undefined") { window._flashConst_Id = "censorSwf"; }
    if (typeof (window._flashConst_Name) == "undefined") { window._flashConst_Name = window._flashConst_Id; }
    if (typeof (window._flashConst_Version) == "undefined") { window._flashConst_Version = "6,0,0,0"; }
    if (typeof (window._flashConst_FlashVars) == "undefined") { window._flashConst_FlashVars = ""; }
    if (typeof (window._flashConst_ParamTags) == "undefined") { window._flashConst_ParamTags = ""; }
    if (typeof (window._flashConst_EmbedAttributes) == "undefined") { window._flashConst_EmbedAttributes = ""; }
    if (typeof (window._flashConst_BgColor) == "undefined") { window._flashConst_BgColor = "#F1FEFF"; }
    if (typeof (window._flashConst_WMode) == "undefined") { window._flashConst_WMode = "opaque"; }
    if (typeof (window._flashConst_Menu) == "undefined") { window._flashConst_Menu = "false"; }
    if (typeof (window._flashConst_Base) == "undefined") { window._flashConst_Base = "."; }
    if (typeof (window._flashConst_AllowScriptAccess) == "undefined") { window._flashConst_AllowScriptAccess = "always"; }
    if (typeof (window._flashConst_Quality) == "undefined") { window._flashConst_Quality = "high"; }
    if (typeof (window._flashConst_Play) == "undefined") { window._flashConst_Play = "true"; }
    if (typeof (window._flashConst_Loop) == "undefined") { window._flashConst_Loop = "false"; }
    if (typeof (window._flashConst_Align) == "undefined") { window._flashConst_Align = "middle"; }
    if (typeof (window._flashConst_Show) == "undefined") { window._flashConst_Show = 1; }
    if (typeof (window._flashConst_ResTolerance) == "undefined") { window._flashConst_ResTolerance = 1.4; }
}

function LanguageEmbedFlash() {
    if (window._flashConst_Show && !window._flashConst_HasPlayedIE) {
        document.write('<embed');
        document.write(' width="' + window._flashConst_Width + '"');
        document.write(' height="' + window._flashConst_Height + '"');
        document.write(' align="' + window._flashConst_Align + '"');
        document.write(' id="' + "censorSwf" + '"');
        document.write(' name="' + "censorSwf" + '"');
        document.write(' flashvars="' + window._flashConst_FlashVars + '"');
        document.write(' src="' + window._flashConst_Path + '"');
        document.write(' menu="' + window._flashConst_Menu + '"');
        document.write(' bgcolor="' + window._flashConst_BgColor + '"');
        document.write(' wmode="' + window._flashConst_WMode + '"');
        document.write(' base="' + window._flashConst_Base + '"');
        document.write(' resTolerance="' + window._flashConst_ResTolerance + '"');
        document.write(' play="' + window._flashConst_Play + '"');
        document.write(' loop="' + window._flashConst_Loop + '"');
        document.write(' quality="' + window._flashConst_Quality + '"');
        document.write(' allowScriptAccess="' + window._flashConst_AllowScriptAccess + '"');
        document.write(' type="application/x-shockwave-flash" ');
        document.write(window._flashConst_EmbedAttributes);
        document.write(' pluginspage="' + window._flashConst_Protocol + '://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
        document.write('</embed>');
    }
}

