// JavaScript Flash plug-in detection
// Also bypasses IE 6.0 "click to activate" feature
// VBScript detection Copyright © 2000 by Apple Computer, Inc., All Rights Reserved.
// Author: Star Global
// May 17, 2006

var flashInstalled = false;
var flashPath = "/flash/logoflash.swf";
var imagePath = "/flash/lasertechlogo.gif";
var flashWidth = 232;
var flashHeight = 83;
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) {
			flashInstalled = true;
		}
	}
}

if (flashInstalled) {


	document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"' + flashWidth + '\" height=\"' + flashHeight + '\">');
	document.write('<param name=\"movie\" value=\"' + flashPath + '\">');
	document.write('<param name=\"quality\" value=\"high\">');
	document.write('<param name=\"wmode\" value=\"transparent\">');
	document.write('<param name=\"bgcolor\" value=\"#FFFFFF\">');
	document.write('<embed src=\"' + flashPath + '\" quality=\"high\" bgcolor=\"#FFFFFF\" wmode=\"transparent\" width=\"' + flashWidth + '\" height=\"' + flashHeight + '\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"><\/embed>');
	document.write('<\/object>');
}
else {
	document.write('<img src=\"' + imagePath + '\" width=\"' + flashWidth + '\" height=\"' + flashHeight + '\" alt=\"\">');
}


function detectFlash() {
    var pluginFound = false;
    if(detectableWithVB) {
	pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
    }
    return (pluginFound);
}
