''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' FlashSnifferVBS API
' Version 1.0.1 
' Last Modified 11/08/2004
' Written by Craig Phares
' Special Thanks To: Joe Tozzini, Macromedia

' Dependencies: BrowserSniffer (browser.js), FlashSnifferJS API (flash.js)

' Supported Platforms:
' Windows, Macintosh

' Supported Browsers:
' IE (Mac only), NS, Opera, Firefox, Safari, AOL

' This script relies on the BrowserSniffer API to reference browser information.
' The FlashSnifferJS API is also needs to be included on the page to work in all
' browsers. This script will check for the Macromedia Flash plug-in. Two global 
' variables are declared, gFlashInstalled - which will return true if Flash is 
' installed, and gFlashVersion - which holds the major version of the Flash 
' plug-in if it exists.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Option Explicit 'Force explicit variable declaration

'test for VBscript engine version 2 or greater (includes all versions of IE4 and beyond and some versions of IE 3)
If ScriptEngine = "VBScript" And ScriptEngineMajorVersion >= 2 Then

	Dim versionStart, i, flashObj 'delcare variables
	
	versionStart = 10 'flash player version starting point for loop
	
	On Error Resume Next
	For i = versionStart To 1 Step -1 
		'if an object for this version number can't be created then an error will occur
		'when the error occurs "On Error Resume Next" will proceed to the next progression in the loop
		Set flashObj = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) 'attempt to create object 					 
		If IsObject(flashObj) Then
			gFlashInstalled = true 
			gFlashVersion = i
			Exit For
		End If
	Next

End If
