window.swfobject = (function(){
    var embeds = [];
    function doEmbed(swf, where, w, h, j1, j2, p1, p2) {
        $('#' + where).flash({
            swf: swf,
            width: w,
            height: h,
            flashvars: $.extend({}, p1, p2)
        });
    }
    return {
        doit: function() {
            if(typeof($) == 'function' && typeof(loadScriptAsync) == 'function' && embeds.length > 0) {
                loadScriptAsync('http://yandex.st/jquery/swfobject/1.0.9/jquery.swfobject.min.js', function() {
                    $.each(embeds, function(){
                        doEmbed.apply({}, this);
                    });
                });
            }
        },
        embedSWF: function() {
            embeds.push(arguments);
        }
    }
})();

