with (navigator) { var uA = userAgent.toLowerCase(); }

/* Determines whether platform is Macintosh or Windows */
var is_mac = (uA.indexOf('mac') != -1);
var is_win	= (uA.indexOf('win') != -1);
var is_ie = (uA.indexOf("msie") != -1);
var hasFlash5 = false;
var hasFlash6 = false;
var detected = false;
var startTagFix = '</';
var msie_windows = 0;
if (is_ie){
  msie_windows = 1;
  document.writeln('<script language="VBscript">');
  document.writeln('\'This will scan for plugins for all versions of Internet Explorer that have a VBscript engine version 2 or greater.');
  document.writeln('\'This includes all versions of IE4 and beyond and some versions of IE 3.');
  document.writeln('Dim detect_through_vb');
  document.writeln('detect_through_vb = 0');
  document.writeln('If ScriptEngineMajorVersion >= 2 then');
  document.writeln('  detect_through_vb = 1');
  document.writeln('End If');
  document.writeln('Function activeXDetect(activeXname)');
  document.writeln('  on error resume next');
  document.writeln('  If ScriptEngineMajorVersion >= 2 then');
  document.writeln('     activeXDetect = False');
  document.writeln('     activeXDetect = IsObject(CreateObject(activeXname))');
  document.writeln('     If (err) then');
  document.writeln('        activeXDetect = False');
  document.writeln('     End If');
  document.writeln('   Else');
  document.writeln('     activeXDetect = False');
  document.writeln('   End If');
  document.writeln('End Function');
  document.writeln(startTagFix+'script>');
}

function pluginDetect() {
    if (activeXDetect('ShockwaveFlash.ShockwaveFlash.5') 
        || activeXDetect('ShockwaveFlash.ShockwaveFlash.6') 
        || activeXDetect('ShockwaveFlash.ShockwaveFlash.7')) {
        hasFlash5 = true;
    } 

    if (activeXDetect('ShockwaveFlash.ShockwaveFlash.6') 
        || activeXDetect('ShockwaveFlash.ShockwaveFlash.7')) {
        hasFlash5 = true;
        hasFlash6 = true;
    }
}

function flashCheck() {
    var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? 
    navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
    if (plugin) {
        var pluginversion = parseInt(plugin.description.substring(plugin.description.indexOf(".") -1))
        if (pluginversion >= 6) {
            hasFlash6 = true;
            hasFlash5 = true;
        } else if (pluginversion >= 5) {
            hasFlash5 = true;
        }
    }
}

if (is_win && is_ie) {
    pluginDetect();
} else {
    flashCheck();
}