; (function($) { $.fn.flash = function(swf, options) { if (options && options.version && !detectVersion(options.version)) return this; return this.each(function() { !$.data(this, 'flash') && $.data(this, 'flash', new flash(this, swf, options)).init() }) }; $.fn.flash.defaults = { params: { allowfullscreen: true, allowscriptaccess: 'always', quality: 'best', wmode: 'transparent', bgcolor: null, flashvars: null, menu: false }, attr: { width: '100%', height: '100%', type: 'application/x-shockwave-flash'} }; function flash(elem, swf, options) { var s = $.extend(true, {}, $.fn.flash.defaults, options); this.init = function() { if (s.params.flashvars && typeof s.params.flashvars == 'object') s.params.flashvars = $.param(s.params.flashvars); var flash = ''; if ($.browser.msie) { s.params.movie = swf; $.each(s.params, function(name, val) { if (val) flash += '<param name="' + name + '" value="' + val + '"/>' }); flash = $('<object>' + flash + '</object>').attr(s.attr) } else { flash = $('<embed/>').attr($.extend({ src: swf }, s.params, s.attr)) }; $(elem).html(flash) } }; function detectVersion(v) { var descr, pv, maxVersion = 10; if (typeof navigator.plugins['Shockwave Flash'] == 'object') { descr = navigator.plugins['Shockwave Flash'].description; descr = descr.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); pv = [descr.replace(/^(.*)\..*$/, "$1"), descr.replace(/^.*\.(.*)\s.*$/, "$1"), /r/.test(descr) ? descr.replace(/^.*r(.*)$/, "$1") : 0] } else if (typeof ActiveXObject == 'function') { var ao; for (var i = maxVersion; i >= 2; i--) { try { ao = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.' + i); if (typeof ao == 'object') { descr = ao.GetVariable('$version'); break } } catch (e) { } }; pv = descr.split(' ')[1].split(',') }; if (!pv && v) return false; function toInt(arr) { return $.map(arr, function(n, i) { return parseInt(n, 10) }) }; v = toInt(v.split('.')); pv = toInt(pv); return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false } })(jQuery);
