var hasFlash = false;
var flashVersion = '';

if (navigator.plugins && navigator.plugins.length) {
    var plugin = navigator.plugins['Shockwave Flash'];
    if (plugin) {
        hasFlash = true;
        if (plugin.description) {
            flashVersion = getFlashVersion(plugin.description);
        }
    }
    
    if (navigator.plugins['Shockwave Flash 2.0']) {
        hasFlash = true;
        flashVersion = '2.0.0.11';
    }
    
}
else 
    if (navigator.mimeTypes && navigator.mimeTypes.length) {
        var mimeType = navigator.mimeTypes['application/x-shockwave-flash'];
        hasFlash = mimeType && mimeType.enabledPlugin;
        if (hasFlash) {
            flashVersion = getFlashVersion(mimeType.enabledPlugin.description);
        }
        
    }
    else {
        try {
            // Try 7 first, since we know we can use GetVariable with it
            var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7');
            hasFlash = true;
            flashVersion = getFlashVersion(ax.GetVariable('$version'));
        } 
        catch (e) {
            // Try 6 next, some versions are known to crash with GetVariable calls
            try {
                var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
                hasFlash = true;
                flashVersion = '6.0.21'; // First public version of Flash 6
            } 
            catch (e) {
                try {
                    // Try the default activeX
                    var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
                    hasFlash = true;
                    flashVersion = getFlashVersion(ax.GetVariable('$version'));
                } 
                catch (e) {
                // No flash
                }
            }
        }
    }
