﻿/**
 * To use this script se example below.
 * FlashInit.init(...args);
 */
var FlashInit = new function () {

    this.init = function (swfUrl,
                        containerId,
                        width,
                        height,
                        version,
                        flashvars,
                        params,
                        attributes) {

        if (typeof flashvars === "undefined" || flashvars == null) {
            flashvars = {};
        }

        if (typeof params === "undefined" || params == null) {
            params = {};
            params.menu = "false";
        }

        if (typeof attributes === "undefined" || attributes == null) {
            var d = new Date();
            var millisec = d.getTime();
            attributes = {};
            attributes.name = "FlashApp_" + millisec;
            attributes.id = "FlashApp_" + millisec;
        }

        if (typeof swfobject === "undefined" || typeof swfobject.embedSWF === "undefined") {
            return;
        }

        $(document).ready(function () {
            swfobject.embedSWF(swfUrl,
                            containerId,
                            width,
                            height,
                            (version || "9.0.0"),
                            "expressInstall.swf",
                            flashvars,
                            params,
                            attributes);
        });
    };
};


