﻿function writeFlashEmbed(swf, width, height, img, moduleId)
{
    var flashOutput = "<embed wmode=\"transparent\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"";
    flashOutput += " " + "src=\"" + swf + "\"";
    if (width.length > 0)
    {
        flashOutput += " " + "width=\"" + width + "\"";
    }
    if (height.length > 0)
    {
        flashOutput += " " + "height=\"" + height + "\"";
    }
    
    if (chkFlash())
    {
        document.getElementById(dnn.getVar("sCtl" + moduleId)).innerHTML = flashOutput + " \>";
    }
    else
    {
        document.getElementById(dnn.getVar("sCtl" + moduleId)).innerHTML = "<div align=\"center\"><img src=\"" + img + "\" /></div>";
    }
}

function chkFlash() {
    var isIE = (navigator.appVersion.indexOf("MSIE") >= 0);
    var hasFlash = true;

    if(isIE) {
        try{
            var objFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
        } catch(e) {
            hasFlash = false;
        }
    } else {
        if(!navigator.plugins["Shockwave Flash"]) {
            hasFlash = false;
        }
    }
    return hasFlash;
}