


function System()
{
    this.SystemPlugins = new PluginList();
    this.SystemBrowser = new Browser();
    this.CheckPopups   = new PopupDetect();
    this.FlashInfo     = new FlashSpecial();

}

function FlashSpecial()
{
   this.flashinstalled = 0;
   this.flashversion = 0;
   this.MSDetect = "false";

this.init = function()
{
   if (navigator.plugins && navigator.plugins.length)
   {
      x = navigator.plugins["Shockwave Flash"];
	  if(x)
	  {
	     this.flashinstalled = 2;
		 if (x.description)
		 {
		    y = x.description;
			this.flashversion = y.charAt(y.indexOf('.')-1);
		 }
	  }
	  else
	  {
		 this.flashinstalled = 1;
	  }
	
	  if (navigator.plugins["Shockwave Flash 2.0"])
	  {
	     this.flashinstalled = 2;
		 this.flashversion = 2;
	  }
   }
}
this.init();
}



function PluginList()
{
   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);
   this.Plugins = new String();
   this.nse = new String();

   this.detectIE = function(ClassID,name) 
   { 
      var 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 ''; 
      }
   }
   
   this.detectNS = function(ClassID,name) 
   { 
      var n = ""; 
      if (this.nse.indexOf(ClassID) != -1) 
      {
          if (navigator.mimeTypes[ClassID].enabledPlugin != null) 
          {
             n = name+","; 
          }
      }      
      return n; 
   }
   
   this.init = function()
   {
      if (this.ie && this.win) 
      {
         this.Plugins = this.detectIE("Adobe.SVGCtl","SVG Viewer") + this.detectIE("SWCtl.SWCtl.1","Shockwave Director") + this.detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + this.detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") + this.detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + this.detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") + 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.Plugins = this.detectNS("image/svg-xml","SVG Viewer") + this.detectNS("application/x-director","Shockwave Director") + this.detectNS("application/x-shockwave-flash","Shockwave Flash") + this.detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + this.detectNS("video/quicktime","QuickTime") + this.detectNS("application/x-mplayer2","Windows Media Player") + this.detectNS("application/pdf","Acrobat Reader");
      }
      
      this.Plugins += navigator.javaEnabled() ? "Java," : "";
      if (this.Plugins.length > 0) 
      {
         this.Plugins = this.Plugins.substring(0,this.Plugins.length-1);
      }
   }
      
   this.init();
}

function Browser()
{
   this.browser = new String();
   this.version = new String();
   this.versionSearchString = new String();
   this.OS = new String();
   
	this.init = function () 
	{
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			        || this.searchVersion(navigator.appVersion)
			        || "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	}
	
	this.searchString = function (data) 
	{
		for (var i=0;i<data.length;i++)	
		{
	       var dataString = data[i].string;
		   var dataProp = data[i].prop;
		   this.versionSearchString = data[i].versionSearch || data[i].identity;
		   
		   if (dataString) 
		   {
		      if (dataString.indexOf(data[i].subString) != -1)
		      {
					return data[i].identity;
			  }
		   }
		   else if (dataProp)
		   {
				return data[i].identity;
		   }
		}
	}
	
	this.searchVersion = function (dataString) 
	{
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) 
		{
		   return;
		}
		else
		{
		   return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
		}
	}
	
	
	this.dataBrowser = [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Internet Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	];
	
	this.dataOS = [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	];

    this.init();

}

function PopupDetect()
{
  this.popUpsBlocked = null;
  
  this.init = function()
  {
    var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no,location=no');
    if(mine)
	{
       this.popUpsBlocked = false;
	   mine.close();
    }
	else
    {
    	this.popUpsBlocked = true;
    }
    var mine = null;
  }
  
  this.init();
}
