
// Flash plug-in detection

var flashInstalled = false;
var detectableWithVB = false;

if (navigator.appName == "Microsoft Internet Explorer") {
//if (true) {
	// Print the function to detect using VBScript

	    document.writeln('<script language="VBscript">');

	    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
	    document.writeln('detectableWithVB = False');
	    document.writeln('If ScriptEngineMajorVersion >= 2 then');
	    document.writeln('  detectableWithVB = True');
	    document.writeln('End If');

	    document.writeln('\'this next function will detect most plugins');
	    document.writeln('Function detectActiveXControl(activeXControlName)');
	    document.writeln('  on error resume next');
	    document.writeln('  detectActiveXControl = False');
	    document.writeln('  If detectableWithVB Then');
	    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
	    document.writeln('  End If');
	    document.writeln('End Function');

	    document.writeln('\'and the following function handles QuickTime');
	    document.writeln('Function detectQuickTimeActiveXControl()');
	    document.writeln('  on error resume next');
	    document.writeln('  detectQuickTimeActiveXControl = False');
	    document.writeln('  If detectableWithVB Then');
	    document.writeln('    detectQuickTimeActiveXControl = False');
	    document.writeln('    hasQuickTimeChecker = false');
	    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
	    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
	    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
	    document.writeln('        detectQuickTimeActiveXControl = True');
	    document.writeln('      End If');
	    document.writeln('    End If');
	    document.writeln('  End If');
	    document.writeln('End Function');

	    document.writeln('</scr' + 'ipt>');

	// Test for flash
	flashInstalled = detectFlash();
} else {
	if ((navigator.plugins) && (navigator.plugins["Shockwave Flash"])) {
	// Unless it can read plugins and flash is there, don't display flash
		var flashDescription = navigator.plugins["Shockwave Flash"].description;
		if (flashDescription.length > 0) {
		  // Unless it can read plugins and flash is there, don't display flash
			// Check for plug in higher than 6.0 release 65
			var dotIndex = flashDescription.indexOf(".");
			var rIndex = flashDescription.indexOf("r");
			var version = parseFloat(flashDescription.substring(dotIndex - 1, rIndex - 1));
			// Get the release from the 3 digits follow the "r" (uncase more than 100 releases)
			var release = parseInt(flashDescription.substring(rIndex + 1, rIndex + 4));
			if (version > 6) {
				flashInstalled = true;
			} else {
				if ((version == 6) && (release >= 65)) {
					flashInstalled = true;
				}
			}
		}
	}
}

function detectFlash() {
    var pluginFound = false;
    if(detectableWithVB) {
	pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
    }
    return (pluginFound);
}