// Detect OS and browser.
//

var OSName = "unknown";
var bName  = "unknown";
var bVer   = "unknown";


if (navigator.appVersion.indexOf("Mac") > 0) OSname = "Mac";
if (navigator.appVersion.indexOf("Win") > 0) OSname = "Win";

if (navigator.appName.substring(0,8) == "Netscape")  bName = "NN";
if (navigator.appName.substring(0,9) == "Microsoft") bName = "IE";

if (parseInt(navigator.appVersion) >= 3) bVer="3x";
if (parseInt(navigator.appVersion) >= 4) bVer="4x";
if (parseInt(navigator.appVersion) >= 5) bVer="5x";



// Plugin detection.
//

function detectPlugin ( ) 
{
	// Pass in synonyms for the plugin.
	//

	var pluginList = detectPlugin.arguments;
	
	var plugin = null;
	
	if ( navigator.plugins && navigator.plugins.length > 0 ) 
	{
		var pluginsArrayLength = navigator.plugins.length;
		
		for ( pluginsArrayCounter = 0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) 
		{
			for ( namesCounter = 0; namesCounter < pluginList.length; namesCounter++ ) 
			{
				if ( navigator.plugins [ pluginsArrayCounter ].name       .indexOf ( pluginList [ namesCounter ] ) >= 0 || 
					 navigator.plugins [ pluginsArrayCounter ].description.indexOf ( pluginList [ namesCounter ] ) >= 0 ) 
				{
					plugin = navigator.plugins [ pluginsArrayCounter ];

					break;
				}   
			}

			if ( plugin != null )
			{
				break;
			}
		}
	}

	return plugin;
}

if ( bName == "IE" && OSname == "Win" ) 
{
	document.writeln ( '<scr' + 'ipt language="VBScript">' );

	// this next function will detect most plugins
	//

	document.writeln ( 'Function detectActiveXControl ( activeXControlName, specialCheck )' );
	document.writeln ( '  If ScriptEngineMajorVersion < 2 then' );
	document.writeln ( '    return False' );
	document.writeln ( '  End If' );
	document.writeln ( '  on error resume next' );
	document.writeln ( '  detectActiveXControl = False' );
	document.writeln ( '  Set theObject = CreateObject(activeXControlName)' );
	document.writeln ( '  on error goto 0' );
	document.writeln ( '  detectActiveXControl = IsObject(theObject)' );
	document.writeln ( '  if detectActiveXControl AND specialCheck > 0 Then' );
	document.writeln ( '    If specialCheck = 1 Then' );
	document.writeln ( '      If NOT theObject.IsQuickTimeAvailable(0) Then' );
	document.writeln ( '        detectActiveXControl = False' );
	document.writeln ( '      End If' );
	document.writeln ( '    End If' );
	document.writeln ( '  End If' );
	document.writeln ( 'End Function' );

	document.writeln ( '</scr' + 'ipt>' );
}
else
{
	eval ( 'function detectActiveXControl ( activeXControlName, specialCheck ) { return false; }' );
}



