' -------------------------------------------------------
' VB BROWSER/PLUGIN DETECTION

Function VBGetFlashVersion()

  ' Catch and ignore errors
  on error resume next

  ' Our variables
  Dim flashControl, flashVersion

  ' Set a default version
  set flashVersion = 0

  ' set list of plugin versions
  Dim pluginVersions
  pluginVersions = Array(6, 5, 4)

  ' Step down through possible versions starting with version 5. (set this number higher to plan for future versions of the Flash Player)
  For Each version in pluginVersions

    ' Set up the classname for the version that we're trying
    Dim classname
    classname = "ShockwaveFlash.ShockwaveFlash." & version

    ' Try to create a control of that version
    set flashControl = CreateObject(classname)

    ' If we succeeded
    if (IsObject(flashControl)) then

      ' set our version and stop trying
      flashVersion = version

      ' found version, lets get out of this loop
      Exit For

    end if

  Next

  ' Set the return value for the function
  VBGetFlashVersion = flashVersion

end Function

' END VB BROWSER/PLUGIN DETECTION
' -------------------------------------------------------

