function canDetectPlugins() {
  return ( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) );
  }

function detectPlugin() {
  var pluginFound = false;
  var daPlugins = detectPlugin.arguments; // handle multiple arguments in a single pass
  if (navigator.plugins && navigator.plugins.length > 0) // then for each plugin...
    for (pluginCounter=0; pluginCounter < navigator.plugins.length; pluginCounter++ ) {
      // loop through all argument names and check each against the current plugin
      var numFound = 0;
      for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
        // if desired plugin name is found in either plugin name or description
        if( (navigator.plugins[pluginCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
            (navigator.plugins[pluginCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
          numFound++;
          // special handling to get QuickTime plugin version
          if (daPlugins[namesCounter] == 'QuickTime') {
            quicktimeVersion = parseFloat(navigator.plugins[pluginCounter].name.substring(18));
            // cannot detect QuickTime version on Safari browser
            if (isNaN(quicktimeVersion) && navigator.userAgent.indexOf("Safari") >= 0) quicktimeVersion = 6.3;
            }
          }
        }
      if(numFound == daPlugins.length) {
        pluginFound = true;
        break; // we found the plugin, stop looking
        }
      } // for (pluginCounter
  return pluginFound;
  }

function detectWindowsMedia() {
  var pluginFound = detectPlugin('Windows Media');
  // if not found, try to detect with VB
  if(!pluginFound && detectableWithVB) pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1');
  return pluginFound;
  }

function detectQuickTime() {
  var pluginFound = detectPlugin('QuickTime');
  // if not found, try to detect with VB
  if(!pluginFound && detectableWithVB) pluginFound = detectQuickTimeActiveXControl();
  return pluginFound;
  }

function detectReal() {
  var pluginFound = detectPlugin('RealPlayer');
  // if not found, try to detect with VB
  if(!pluginFound && detectableWithVB) pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') ||
      detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') ||
      detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
  return pluginFound;
  }

function detectFlash() {
  var pluginFound = detectPlugin('Shockwave','Flash'); 
  // if not found, try to detect with VB
  if(!pluginFound && detectableWithVB) pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
  return pluginFound;
  }

function detectDirector() { 
  var pluginFound = detectPlugin('Shockwave','Director'); 
  // if not found, try to detect with VB
  if(!pluginFound && detectableWithVB) pluginFound = detectActiveXControl('SWCtl.SWCtl.1');
  return pluginFound;
  }

function detectWMP() {
  var wmpInfo = {
    installed: false,
    scriptable: false,
    typeOfPlayer: null,
    versionInfo: null
    };
  if ((window.ActiveXObject && navigator.userAgent.indexOf('Windows') != -1) || window.GeckoActiveXObject) {
    wmpInfo.typeOfPlayer = "ActiveX";
    var player = createActiveXObject("WMPlayer.OCX.7");
    if (player) {
      wmpInfo.installed = true;
      wmpInfo.scriptable = true;
      wmpInfo.versionInfo = player.versionInfo;
      }
    else {
      player = createActiveXObject("MediaPlayer.MediaPlayer.1");
      if (player) {
        wmpInfo.installed = true;
        wmpInfo.scriptable = true;
        wmpInfo.versionInfo = "6.4";
        }
      else wmpInfo.versionInfo = "none";
      }
    }
  else if (navigator.mimeTypes) {
    wmpInfo.typeOfPlayer = "plugin";
    var player = null;
    if (navigator.mimeTypes['application/x-mplayer2'])
        player = navigator.mimeTypes['application/x-mplayer2'].enabledPlugin;
    if (player) {
      wmpInfo.installed = true;
      wmpInfo.versionInfo = "any";
      }
    }
  return wmpInfo;
  }
