/*
 * [toolbox.flashembed]
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 * File generated: Tue Jul 27 14:51:24 GMT 2010
 */
(function () {
    function f(a, b) {
        if (b) for (key in b) if (b.hasOwnProperty(key)) a[key] = b[key];
        return a
    }
    function l(a, b) {
        var c = [];
        for (var d in a) if (a.hasOwnProperty(d)) c[d] = b(a[d]);
        return c
    }
    function m(a, b, c) {
        if (e.isSupported(b.version)) a.innerHTML = e.getHTML(b, c);
        else if (b.expressInstall && e.isSupported([6, 65])) a.innerHTML = e.getHTML(f(b, {
            src: b.expressInstall
        }), {
            MMredirectURL: location.href,
            MMplayerType: "PlugIn",
            MMdoctitle: document.title
        });
        else {
            if (!a.innerHTML.replace(/\s/g, "")) {
                a.innerHTML = "<h2>Flash version " + b.version + " or greater is required</h2><h3>" + (g[0] > 0 ? "Your version is " + g : "You have no flash plugin installed") + "</h3>" + (a.tagName == "A" ? "<p>Click here to download latest version</p>" : "<p>Download latest version from <a href='" + k + "'>here</a></p>");
                if (a.tagName == "A") a.onclick = function () {
                    location.href = k
                }
            }
            if (b.onFail) {
                var d = b.onFail.call(this);
                if (typeof d == "string") a.innerHTML = d
            }
        }
        if (h) window[b.id] = document.getElementById(b.id);
        f(this, {
            getRoot: function () {
                return a
            },
            getOptions: function () {
                return b
            },
            getConf: function () {
                return c
            },
            getApi: function () {
                return a.firstChild
            }
        })
    }
    var h = document.all,
        k = "http://www.adobe.com/go/getflashplayer",
        n = typeof jQuery == "function",
        o = /(\d+)[^\d]+(\d+)[^\d]*(\d*)/,
        i = {
            width: "100%",
            height: "100%",
            id: "_" + ("" + Math.random()).slice(9),
            allowfullscreen: true,
            allowscriptaccess: "always",
            quality: "high",
            version: [3, 0],
            onFail: null,
            expressInstall: null,
            w3c: false,
            cachebusting: false
        };
    window.attachEvent && window.attachEvent("onbeforeunload", function () {
        __flash_unloadHandler = function () {};
        __flash_savedUnloadHandler = function () {}
    });
    window.flashembed = function (a, b, c) {
        if (typeof a == "string") a = document.getElementById(a.replace("#", ""));
        if (a) {
            if (typeof b == "string") b = {
                src: b
            };
            return new m(a, f(f({}, i), b), c)
        }
    };
    var e = f(window.flashembed, {
        conf: i,
        getVersion: function () {
            var a;
            try {
                a = navigator.plugins["Shockwave Flash"].description.slice(16)
            } catch (b) {
                try {
                    var c = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
                    a = c && c.GetVariable("$version")
                } catch (d) {}
            }
            return (a = o.exec(a)) ? [a[1], a[3]] : [0, 0]
        },
        asString: function (a) {
            if (a === null || a === undefined) return null;
            var b = typeof a;
            if (b == "object" && a.push) b = "array";
            switch (b) {
            case "string":
                a = a.replace(new RegExp('(["\\\\])', "g"), "\\$1");
                a = a.replace(/^\s?(\d+\.?\d+)%/, "$1pct");
                return '"' + a + '"';
            case "array":
                return "[" + l(a, function (d) {
                    return e.asString(d)
                }).join(",") + "]";
            case "function":
                return '"function()"';
            case "object":
                b = [];
                for (var c in a) a.hasOwnProperty(c) && b.push('"' + c + '":' + e.asString(a[c]));
                return "{" + b.join(",") + "}"
            }
            return String(a).replace(/\s/g, " ").replace(/\'/g, '"')
        },
        getHTML: function (a, b) {
            a = f({}, a);
            var c = '<object width="' + a.width + '" height="' + a.height + '" id="' + a.id + '" name="' + a.id + '"';
            if (a.cachebusting) a.src += (a.src.indexOf("?") != -1 ? "&" : "?") + Math.random();
            c += a.w3c || !h ? ' data="' + a.src + '" type="application/x-shockwave-flash"' : ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
            c += ">";
            if (a.w3c || h) c += '<param name="movie" value="' + a.src + '" />';
            a.width = a.height = a.id = a.w3c = a.src = null;
            a.onFail = a.version = a.expressInstall = null;
            for (var d in a) if (a[d]) c += '<param name="' + d + '" value="' + a[d] + '" />';
            a = "";
            if (b) {
                for (var j in b) if (b[j]) {
                    d =
                    b[j];
                    a += j + "=" + (/function|object/.test(typeof d) ? e.asString(d) : d) + "&"
                }
                a = a.slice(0, -1);
                c += '<param name="flashvars" value=\'' + a + "' />"
            }
            c += "</object>";
            return c
        },
        isSupported: function (a) {
            return g[0] > a[0] || g[0] == a[0] && g[1] >= a[1]
        }
    }),
        g = e.getVersion();
    if (n) {
        jQuery.tools = jQuery.tools || {
            version: "1.2.3"
        };
        jQuery.tools.flashembed = {
            conf: i
        };
        jQuery.fn.flashembed = function (a, b) {
            return this.each(function () {
                $(this).data("flashembed", flashembed(this, a, b))
            })
        }
    }
})();
