﻿// JScript File
function writeFlash(div_id, id, flash_name, width, height, color, transparent, FlashVars) {
    var element = document.getElementById(div_id)
    if (element) {
        element.innerHTML = _toString(id, flash_name, width, height, color, transparent, FlashVars);
    }
}

function _toString(id, flash_name, width, height, color, transparent, FlashVars) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return this._toStringForExplorer(id, flash_name, width, height, color, transparent, FlashVars);
    }
    else {
        return this._toStringForStandard(id, flash_name, width, height, color, transparent, FlashVars);
    }
}

function _toStringForExplorer(id, flash_name, width, height, color, transparent, FlashVars) {
    var str = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"";
    str += " id=\"" + id + "\"";
    str += " codebase=\"" + location.protocol + "//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,12,36\"";
    str += " width=\"" + width + "\" ";
    str += " height=\"" + height + "\"";
    str += ">";
    if (typeof FlashVars != "undefined") {
        str += "<param name=\"FlashVars\" value=\"" + FlashVars + "\" />";
    }
    str += "<param name=\"width\" value=\"" + width + "\" />";
    str += "<param name=\"height\" value=\"" + height + "\" />";
    str += "<param name=\"movie\" value=\"" + flash_name + "\" />";
    str += "<param name=\"allowFullScreen\" value=\"true\" />";
    str += "<param name=\"bgcolor\" value=\"" + color + "\" />";
    str += "<param name=\"wmode\" value=\"transparent\">";
    str += "</object>";
    return str;
}

function _toStringForStandard(id, flash_name, width, height, color, transparent, FlashVars) {

    var str = "<embed src=\"" + flash_name + "\" wmode='transparent'  width=\"" + width + "\" height=\"" + height + "\" salign=\"tl\" scale=\"noScale\" quality=\"high\" ";
    if (typeof FlashVars != "undefined") {
        str += "FlashVars=\"" + FlashVars + "\" ";
    }
    str += "type=\"application/x-shockwave-flash\" ";
    str += "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ";
    str += "id=\"" + id + "\"";
    str += "allowFullScreen=\"true\" ";
    str += "wmode=\"" + transparent + "\" ";
    str += "bgcolor=\"" + color + "\" ";
    str += "></embed>";
    return str;
}
