/*********************************************************************************************
  Creates browser properties indicating:
  (1) browser vendor:
		nav, ie, opera, hotjava, webtv, TVNavigator, AOLTV
  (2) browser version number:
      	major (integer indicating major version number: 2, 3, 4 ...)
      	minor (float indicating full version number: 2.02, 3.01, 4.04 ...)
  (3) browser vendor AND major version number
      	nav2, nav3, nav4, nav4up, nav6, nav6up, gecko,
		ie3, ie4, ie4up, ie5, ie5up, ie5_5,
		hotjava3, hotjava3up,
      	opera2, opera3, opera4, opera5, opera5up
  (4) JavaScript version number:
      	js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
  (5) OS platform and version:
      	win, win31, win95, winnt, win98, winme, win2k,
		os2, mac, mac68k, macppc,
		unix, sun, sun4, sun5, suni86,
		irix, irix5, irix6,
		hpux, hpux9, hpux10,
		aix, aix1, aix2, aix3, aix4
		linux, sco, unixware, ncr, reliant,
		dec, sinix, freebsd, bsd,
		vms
*********************************************************************************************/

var browse = new brinfo();

/*********************************************************************************************
  This is the constructor function for browse (above).
*********************************************************************************************/
function brinfo()
{
/*************************************************************************
               Browser Name and Version
*************************************************************************/
var agt = navigator.userAgent.toLowerCase();
var xx  = 0;

this.major = parseInt(navigator.appVersion);
this.minor = parseFloat(navigator.appVersion);
this.name = "Unknown";
this.version = "Unknown";



/********************************************************
  Checking for browser and version. First Netscape.
*********************************************************/
this.nav = 0;
if ((agt.indexOf('mozilla') != -1) &&
    (agt.indexOf('spoofer') == -1) &&
    (agt.indexOf('compatible') == -1) &&
	(agt.indexOf('opera') == -1) &&
	(agt.indexOf('webtv') == -1) &&
	(agt.indexOf('hotjava') == -1))
	{
	this.nav = -1;
	this.name = "Netscape Navigator";
	this.version = this.minor;

	if (this.major == 2)
		this.nav2 = -1
	else if (this.major == 3)
		this.nav3 = -1
	else if (this.major == 4)
		this.nav4 = -1
	else if (this.major == 5)
		this.nav6 = -1;
		
	if (this.major >= 4)
		this.nav4up = -1;
	}

if (agt.indexOf('gecko') != -1)
	{
	this.name = "Netscape Gecko";
	for (xx = 0; xx < agt.length; xx++)
		if (agt.substring(xx, xx+8) == "netscape")
			this.version = agt.substring(xx+10, xx+14);

	this.nav4up = -1;	
	}
  
/********************************************************
  Internet Explorer.
*********************************************************/
this.ie = 0;
if ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1))
	{
	this.ie = -1;
	this.name = "Internet Explorer";
	this.version = ( (this.major + 1) + "." + (this.minor + 1) );

	if	(this.major < 4)
		this.ie3 = -1
	else if	( (this.major == 4) && (agt.indexOf("msie 5")==-1) )
		this.ie4 = -1
	else if	( (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) )
		this.ie5 = -1
	else if	( (this.major == 4) && (agt.indexOf("msie 5.5") !=-1) )
		this.ie5_5 = -1;

	if	(!this.ie3 && !this.ie4)
		this.ie5up = -1;

	if	(this.major >= 4)
		this.ie4up= -1;
	}
 
/********************************************************
  AOL
*********************************************************/
this.aol = 0;
if	(agt.indexOf("aol") != -1)
	{
	this.name = "AOL";
	this.aol = -1;
	}

if	(this.aol && this.ie3)
	this.aol3 = -1;

if	(this.aol && this.ie4)
	this.aol4 = -1;

if	(agt.indexOf("aol 5") != -1)
	this.aol5 = -1;

if	(agt.indexOf("aol 6") != -1)
	this.aol6 = -1;
  
/********************************************************
  Opera.
*********************************************************/
this.opera = 0;
if	(agt.indexOf("opera") != -1)
	{
	this.opera = -1;

	if	(agt.indexOf("opera 2") != -1 ||
		 agt.indexOf("opera/2") != -1)
		this.opera2 = -1
	else if	(agt.indexOf("opera 3") != -1 ||
	 		 agt.indexOf("opera/3") != -1)
		this.opera3 = -1
	else if	(agt.indexOf("opera 4") != -1 ||
			 agt.indexOf("opera/4") != -1)
		this.opera4 = -1
	else if	(agt.indexOf("opera 5") != -1 ||
			 agt.indexOf("opera/5") != -1)
		this.opera5 = -1;

	if	(this.opera && !this.opera2 && !this.opera3 && !this.opera4)
		this.opera5up = -1;
	}
 
/********************************************************
  Miscellaneous others.
*********************************************************/
this.webtv = 0;
if	(agt.indexOf("webtv") != -1)
	{
	this.webtv = -1;
	this.name = "Web TV";
	}

if	((agt.indexOf("navio") != -1) ||
	 (agt.indexOf("navio_aoltv") != -1))
	{
	this.aoltv = -1;
	this.name = "AOL TV";
	}

if	(agt.indexOf("hotjava") != -1)
	{
	this.hotjava = -1;
	this.name = "Hot Java";
	}

if	(this.hotjava && (this.major == 3))
	this.hotjava3 = -1;

if	(this.hotjava && (this.major >= 3))
	this.hotjava3up = -1;


/*********************************************************************************************
                      *** JAVASCRIPT VERSION CHECK ***
*********************************************************************************************/
if (this.nav2 ||
	this.ie3)
		this.js = 1.0
	
else if (this.nav3   ||
		 this.opera2 ||
		 this.opera3 ||
		 this.opera4)
	this.js = 1.1
	
else if ( (this.nav4 && (this.minor <= 4.05)) ||
		  this.ie4 )
	this.js = 1.2

else if (this.opera5up ||
		 this.ie5_5    ||
		 (this.nav4 && (this.minor > 4.05)) )
	this.js = 1.3
	
else if (this.hotjava3up)
	this.js = 1.4

else if (this.nav6 || this.gecko)
	this.js = 1.5;

/*********************************************************************************************
                             *** Java Enabled ***
*********************************************************************************************/
if (navigator.javaEnabled() == true)
	this.java = "Enabled";
else
	this.java = "Not Enabled";


/*********************************************************************************************
                             *** PLATFORM ***
*********************************************************************************************/
if	((agt.indexOf("win")!=-1) ||
	 (agt.indexOf("16bit")!=-1) )
	this.win = -1;

if	((agt.indexOf("win95")!=-1) ||
	 (agt.indexOf("windows 95")!=-1))
	{
	this.win95 = -1;
	this.os = "Windows95";
	}

if	((agt.indexOf("windows 3.1")!=-1) ||
	 (agt.indexOf("win16")!=-1) ||
	 (agt.indexOf("windows 16-bit")!=-1))
	{
	this.win31 = -1;
	this.os = "Windows3.1";
	}

if	((agt.indexOf("win 9x 4.90")!=-1))
	{
	this.winme = -1;
	this.os = "WindowsME";
	}
			
if	((agt.indexOf("winnt")!=-1) ||
	 (agt.indexOf("windows nt")!=-1))
	{
	this.winnt = -1;
	this.os = "WindowsNT";
	}

if	((agt.indexOf("windows nt 5.0")!=-1))
	{
	this.win2k = -1;
	this.os = "Windows2000";
	}

if	((agt.indexOf("win98")!=-1) ||
	 (agt.indexOf("windows 98")!=-1))
	{
	this.win98 = -1;
	this.os = "Windows98";
	}
			
if	((agt.indexOf("os/2")!=-1) ||
	 (navigator.appVersion.indexOf("OS/2")!=-1) ||
	 (agt.indexOf("ibm-webexplorer")!=-1))
	{
	this.os2 = -1;
	this.os = "OS2";
	}
				
if	(agt.indexOf("mac")!=-1)
	this.mac = -1;

if	(this.mac && ((agt.indexOf("68k")!=-1) ||
	(agt.indexOf("68000")!=-1)))
	{
	this.mac68k = -1;
	this.os = "MAC68000";
	}
				
if	(this.mac && ((agt.indexOf("ppc")!=-1) ||
	(agt.indexOf("powerpc")!=-1)))
	{
	this.macpc = -1;
	this.os = "MAC PC";
	}
				
if	(agt.indexOf("sunos")!=-1)
	this.sun = -1;

if	(agt.indexOf("sunos 4")!=-1)
	{
	this.sun4 = -1;
	this.os = "SunOS 4";
	}

if	(agt.indexOf("sunos 5")!=-1)
	{
	this.sun5 = -1;
	this.os = "SunOS 5";
	}

if	(this.sun && (agt.indexOf("i86")!=-1))
	{
	this.suni86 = -1;
	this.os = "Suni86";
	}

if	(agt.indexOf("irix") !=-1)
	this.irix = -1;

if	( (agt.indexOf("irix 6") !=-1) ||
	  (agt.indexOf("irix6") !=-1) )
	{
	this.irix6 = -1;
	this.os = "Irix 6";
	}
				
if	(agt.indexOf("hp-ux")!=-1)
	this.hpux = -1;

if	(this.hpux && (agt.indexOf("09.")!=-1))
	{
	this.hpux9 = -1;
	this.os = "HP Unix 9";
	}

if	(this.hpux && (agt.indexOf("10.")!=-1))
	{
	this.hpux10 = -1;
	this.os = "HP Unix 10";
	}

/*********************************************************************************************
                                   IBM
*********************************************************************************************/
if	(agt.indexOf("aix") !=-1)
	this.aix = -1;

if	(agt.indexOf("aix 1") !=-1)
	{
	this.aix1 = -1;
	this.os = "AIX 1";
	}

if	(agt.indexOf("aix 2") !=-1)
	{
	this.aix2 = -1;
	this.os = "AIX 2";
	}

if	(agt.indexOf("aix 3") !=-1)
	{
	this.aix3 = -1;
	this.os = "AIX 3";
	}

if	(agt.indexOf("aix 4") !=-1)
	{
	this.aix4 = -1;
	this.os = "AIX 4";
	}

if	(agt.indexOf("inux")!=-1)
	{
	this.linux = -1;
	this.os = "Linux";
	}

if	( (agt.indexOf("sco")!=-1) ||
	  (agt.indexOf("unix_sv")!=-1) )
	{
	this.sco = -1;
	this.os = "SCO Unix";
	}
			
if	(agt.indexOf("unix_system_v")!=-1)
	{
	this.unixware = -1;
	this.os = "Unix System 5";
	}

if	(agt.indexOf("ncr")!=-1)
	{
	this.ncr = -1;
	this.os = "NCR";
	}

if	(agt.indexOf("reliantunix")!=-1)
	{
	this.reliant = -1;
	this.os = "Reliant Unix";
	}

if	((agt.indexOf("dec")!=-1) ||
	 (agt.indexOf("osf1")!=-1) ||
	 (agt.indexOf("dec_alpha")!=-1) ||
	 (agt.indexOf("alphaserver")!=-1) ||
	 (agt.indexOf("ultrix")!=-1) ||
	(agt.indexOf("alphastation")!=-1))
	{
	this.dec = -1;
	this.os = "DEC";
	}

if	(agt.indexOf("sinix")!=-1)
	{
	this.sinux = -1;
	this.os = "Sinix";
	}

if	(agt.indexOf("freebsd")!=-1)
	{
	this.freebsd = -1;
	this.os = "FreeBSD";
	}

if	(agt.indexOf("bsd")!=-1)
	{
	this.bsd = -1;
	this.os = "BSD";
	}

if	(	(agt.indexOf("x11")!=-1)  ||
	  	this.sun                  ||
	  	this.irix                 ||
	  	this.hpux                 ||
		this.sco                  ||
		this.unixware             ||
		this.ncr	              ||
		this.reliant              ||
		this.dec                  ||
		this.sinix                ||
		this.aix                  ||
		this.linux                ||
		this.bsd                  ||
		this.freebsd)
	this.unix = -1;

				 
if	((agt.indexOf("vax")!=-1) ||
	 (agt.indexOf("openvms")!=-1))
	{
	this.vms = -1;
	this.os = "VMS";
	}
}
