/* CLASS TO DETECT BROWSER-CAPABILITIES */

var Class_PlugInDetect=new Class({
	agt:'',								// agent
	ie:'',								// is ie
	ns:'',								// netscape
	win:'',								// windows
	mac:'',								// mac
	pluginlist:'',				// plugin-list
	nse:'',								// netscape mime-list
	initialize: function() {
    this.agt=navigator.userAgent.toLowerCase();
    this.ie=(this.agt.indexOf("msie") != -1);
    this.ns=(navigator.appName.indexOf("Netscape") != -1);
    this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("32bit")!=-1));
    this.mac=(this.agt.indexOf("mac")!=-1);

    if(this.ie && this.win) {
      this.pluginlist+=this.detectIE("Adobe.SVGCtl","SVG Viewer");
      this.pluginlist+=this.detectIE("SWCtl.SWCtl.1","Shockwave Director");
      this.pluginlist+=this.detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash");
      this.pluginlist+=this.detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer");
      this.pluginlist+=this.detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime");
      this.pluginlist+=this.detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player");
      this.pluginlist+=this.detectIE("PDF.PdfCtrl.5","Acrobat Reader");
    }
    if(this.ns || !this.win) {
      this.nse="";
      for(var i=0;i<navigator.mimeTypes.length;i++) {
        this.nse+=navigator.mimeTypes[i].type.toLowerCase();
      }
      this.pluginlist+=this.detectNS("image/svg-xml","SVG Viewer");
      this.pluginlist+=this.detectNS("application/x-director","Shockwave Director");
      this.pluginlist+=this.detectNS("application/x-shockwave-flash","Shockwave Flash");
      this.pluginlist+=this.detectNS("audio/x-pn-realaudio-plugin","RealPlayer");
      this.pluginlist+=this.detectNS("video/quicktime","QuickTime");
      this.pluginlist+=this.detectNS("application/x-mplayer2","Windows Media Player");
      this.pluginlist+=this.detectNS("application/pdf","Acrobat Reader");
    }

    this.pluginlist+=navigator.javaEnabled() ? "Java," : "";
    if(this.pluginlist.length>0) {
      this.pluginlist=this.pluginlist.substring(0,this.pluginlist.length-1);
    }
	},
	detectIE: function(ClassID,name) {
    result=false;
    document.write('<' + 'SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</' + 'SCRIPT>\n');
    if(result) {  return name+',';  }
    else {  return '';  }
	},
	detectNS: function(ClassID,name) {
    var n="";
    if(this.nse.indexOf(ClassID)!=-1) {
      if(navigator.mimeTypes[ClassID].enabledPlugin!=null) {
        n=name+",";
        return n;
      } else {
      	return '';
      }
    } else {
    	return '';
    }
	},
	check: function(name) {
		if(this.pluginlist.indexOf("Windows Media Player")!=-1) {
			return true;
		} else {
			return false;
		}
	}
});

// create instance of class
var PluginList;
PluginList=new Class_PlugInDetect();
