/*	Copyright (C) 2004 Warp Critical Limited.  All Rights Reserved. */

var agt=navigator.userAgent.toLowerCase();
var ie  = (agt.indexOf("msie") != -1);
var ns  = (navigator.appName.indexOf("Netscape") != -1);
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);
var haveqt = false;
var havemf = false;
var pluginlist = "";
var nse="";
var detectresultie=false;

if (ie && win) {
	pluginlist=detectIE("Adobe.SVGCtl","SVG Viewer")
					+detectIE("SWCtl.SWCtl.1","Shockwave Director")
					+detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash")
					+detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer")
					+detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime")
					+detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player")
					+detectIE("PDF.PdfCtrl.5","Acrobat Reader");
}
if (ns || !win) {		
	nse="";
	for (var i=0 ; i<navigator.mimeTypes.length ; i++)
		nse+=navigator.mimeTypes[i].type.toLowerCase();
		
	pluginlist=detectNS("image/svg-xml","SVG Viewer")
					+detectNS("application/x-director","Shockwave Director")
					+detectNS("application/x-shockwave-flash","Shockwave Flash")
					+detectNS("audio/x-pn-realaudio-plugin","RealPlayer")
					+detectNS("video/quicktime","QuickTime")
					+detectNS("application/x-mplayer2","Windows Media Player")
					+detectNS("application/pdf","Acrobat Reader");
		
}

pluginlist+=(navigator.javaEnabled() ? "Java," : "");
if (pluginlist.length>0)
	pluginlist=pluginlist.substring(0,pluginlist.length-1); 

if (pluginlist.indexOf("QuickTime")!=-1) 
	haveqt=true;
else 
	haveqt=detectQT();

if (pluginlist.indexOf("Shockwave Flash")!=-1)
	havemf=true;

function detectIE(ClassID,name) {
	detectresultie=false;
	document.write('<script language=VBScript>\n on error resume next \n detectresultie=IsObject(CreateObject("'+ClassID+'"))</script>\n');
	if (detectresultie)
		return name+',';
	else
		return '';
}
function detectNS(ClassID,name) {
	var n="";
	if (nse.indexOf(ClassID)!=-1)
		if (navigator.mimeTypes[ClassID].enabledPlugin!=null)
			n = name+",";
	return n;
}
function detectQT() {
   // NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Quicktime plugin in plugin array
   if (navigator.plugins != null && navigator.plugins.length > 0) {
      for (var i=0; i < navigator.plugins.length; i++ ) {
         var plugin =navigator.plugins[i];
         if (plugin.name.indexOf("QuickTime") > -1) {
		return true;
         }
      }
   }
   return false;
}