/*
Plug-in Sniffer
----------------------------------------

This tries to detect the following plug-ins:
Flash
QuickTime
RealPlayer
Windows Media

Also attempts to ascertain the version of the Flash plug-in if 
installed. Gives version = 0 for the other plug-ins.

Sets the following variables:
hasPlugin (defaults to false if it can't detect)
pluginVersion (defaults to 0 if it can't detect)

Use this by calling the pluginExists() function, passing plug-in you 
want to check as a parameter, e.g.
pluginExists('flash')
pluginExists('quicktime')
pluginExists('realplayer')
pluginExists('windowsmedia')

Fails in the following browsers (i.e. defaults to hasPlugin = false 
& pluginVersion = 0);
Internet Explorer 4.x (Macintosh only)
Internet Explorer 3.x
No way around this as far as I know.
*/
<!--
var isIEWin = 0;
var theUserAgent = navigator.userAgent.toLowerCase();
if (theUserAgent.indexOf('win')!=-1 && navigator.appName.indexOf('Microsoft')!=-1 && navigator.appVersion.indexOf('3.1')==-1 && navigator.appVersion.indexOf('4.')!=-1) isIEWin = 1;

if (isIEWin) {
	document.writeln('\<scr' + 'ipt language="VBScript"\>');
	document.writeln('function getWinIEFlashVersion()');
	document.writeln('	Dim i');
	document.writeln('	on error resume next');
	document.writeln('	for i = 2 to 5');
	//..............................^ this is the latest major flash version - modify as necessary
	document.writeln('		objExists = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i)))');
	document.writeln('		if objExists = true then ');
	document.writeln('			getWinIEFlashVersion = i');
	document.writeln('		end if');
	document.writeln('		objExists = false');
	document.writeln('	next');
	document.writeln('end function');
	document.writeln('function IEDetectObject(ClassID)');
	document.writeln('	on error resume next');
	document.writeln('	hasPlugin = IsObject(CreateObject(ClassID))');
	document.writeln('	IEDetectObject = hasPlugin');
	document.writeln('end function');
	document.writeln('\</scr' + 'ipt\>');
}

var plugInName = "";
var hasPlugin = false;
var pluginVersion = "0";
function pluginExists(plugin) {
	hasPlugin = false;
	pluginVersion = "0";
	if (plugin == "flash") {
		plugInName = "Shockwave Flash";
		var winIEObjectName = "ShockwaveFlash.ShockwaveFlash";
	}
	else if (plugin == "quicktime") {
		plugInName = "QuickTime";
		var winIEObjectName = "QuickTimeCheckObject.QuickTimeCheck.1";
	}
	else if (plugin == "realplayer") {
		plugInName ="RealPlayer";
		var winIEObjectName ="rmocx.RealPlayer G2 Control.1";
	}
	else if (plugin == "windowsmedia") {
		plugInName = "Windows Media";
		var winIEObjectName = "'MediaPlayer.MediaPlayer.1'";
	}
	
	// Browsers that support navigator.plugins properly
	if (navigator.appName.indexOf('Microsoft')==-1 || (navigator.plugins && navigator.plugins.length)) {
		for (var i1=0; i1<navigator.plugins.length; i1++) {
			if (navigator.plugins[i1].name.indexOf(plugInName)!=-1) {
				hasPlugin = true;
				if (plugin == "flash" && hasPlugin) {
					pluginDesc = navigator.plugins[i1].description.split(" ");
					for (var i2=0; i2<pluginDesc.length; i2++) {
						if (isNaN(parseInt(pluginDesc[i2]))) continue;
						pluginVersionFull = pluginDesc[i2].split(".");
						pluginVersion = pluginVersionFull[0];
					}
				}
				break;
			}
		}
	} 
	// IE on windows
	else if (isIEWin) {
		if (plugin == "flash") pluginVersion = getWinIEFlashVersion();
		IEDetectObject(winIEObjectName);
	}
}
//-->