//
// Need to include : FSS_StringHandler_c.js
//

	//===============================================================================
	//	FUNCTION:	FSS_BrowserDetector
	// 
	//	INPUT: 		strBrowserAttrib (String) - Represent the HTTP browser format.
	//
	//	RETURN:		<nothing>
	//
	//	DESC:		This function is used with client-side JavaScript to detect
	//				the brand and version of the user's browser.
	//				Object members : strBrowser		- Users browser name.
	//								 strPlatform	- Users OS platform.
	//								 nVersion		- Browser version (Whole).
	//								 nMajorVersion	- Browser version (Major #).
	//								 nMinorVersion 	- Browser version (Minor #).
	//
	//	PLATFORMS:	Netscape Navigator 3.01 and higher,
	//			  	Microsoft Internet Explorer 3.02 and higher,
	//
	//	EXAMPLE:	var objBrowserVer = new FSS_BrowserDetect(navigator.userAgent);
	//
	//===============================================================================
	function FSS_BrowserDetector(strBrowserAttrib)
	{
		// Init vars
		this.strBrowser = new String("Unknown");
		this.strPlatform = new String("Unknown");
		this.nVersion = new Number(0.0);
		this.nMajorVersion = new Number(0);
		this.nMinorVersion = new Number(0);

		// Split into stuff before parens and stuff in parens
		var strPreparens = new String();
		var strParenthesized = new String();
		var nInputLen = strBrowserAttrib.length;

		// - Strip into to pieces; browser & parameters
		var nWork1 = strBrowserAttrib.indexOf("(");
		if (nWork1 >= 0)
		{
			strPreparens = Trim(strBrowserAttrib.substring(0, nWork1));
			strParenthesized = strBrowserAttrib.substring((nWork1+1), nInputLen);
			nWork1 = strParenthesized.indexOf(")");
			if (nWork1 >= 0)
			{
				strParenthesized = strParenthesized.substring(0, nWork1);
			}
		}
		else
		{
			strPreparens = strBrowserAttrib;
		}

		// First assume browser and version are in preparens
		// override later if we find them in the parenthesized stuff
		var strBrowVer = new String(strPreparens);

		var strTokens = strParenthesized.split(";");
		var strToken = new String();

		// - Loop & process tokens
		for (nWork1 = 0; nWork1 < strTokens.length; nWork1++)
		{
			// - Get parsed tokens
			strToken = Trim(strTokens[nWork1]);
			
			// - 'Browser Version' try for overides MSIE, Opera, compatable
			if (strToken == "compatible")
			{
				// Assume that we are really is Mozilla
				strBrowVer = strToken;
			}
			else if (strToken.indexOf("MSIE") >= 0)
			{
				strBrowVer = strToken;
			}
			else if (strToken.indexOf("Opera") >= 0)
			{
				strBrowVer = strToken;
			}
			
			// - 'Platform' try for X11, SunOS, Win, Mac, PPC
			else if ((strToken.indexOf("X11") >= 0) ||
					 (strToken.indexOf("SunOS") >= 0) ||
					 (strToken.indexOf("Linux") >= 0))
			{
				this.strPlatform = "Unix";
			}
			else if (strToken.indexOf("Win") >= 0)
			{
				this.strPlatform = strToken;
			}
			else if ((strToken.indexOf("Mac") >= 0) ||
					 (strToken.indexOf("PPC") >= 0))
			{
				this.strPlatform = strToken;
			}
		}	// for (nWork1 = 0; nWork1 < strTokens.length; nWork1++)

		// - Special formatting for browser version
		var sWork1 = new String();
		nWork1  = strBrowVer.indexOf("MSIE");
		if (nWork1 >= 0)
		{
			strBrowVer = strBrowVer.substring(nWork1, strBrowVer.length);
		}
		if (strBrowVer.substring(0, "Mozilla".length) == "Mozilla")
		{
			this.strBrowser = "Netscape";
			sWork1 = strBrowVer.substring("Mozilla".length+1,
										  strBrowVer.length);
		}
		else if (strBrowVer.substring(0, "Lynx".length) == "Lynx")
		{
			this.strBrowser = "Lynx";
			sWork1 = strBrowVer.substring("Lynx".length+1,
										  strBrowVer.length);
		}
		else if (strBrowVer.substring(0, "MSIE".length) == "MSIE")
		{
			this.strBrowser = "IE";
			sWork1 = strBrowVer.substring("MSIE".length+1,
										  strBrowVer.length);
		}
		else if (strBrowVer.substring(0, "Microsoft Internet Explorer".length) ==
				 "Microsoft Internet Explorer")
		{
			this.browser = "IE"
			sWork1 = strBrowVer.substring("Microsoft Internet Explorer".length+1,
										  strBrowVer.length);
		}
		else if (strBrowVer.substring(0, "Opera".length) == "Opera")
		{
			this.browser = "Opera"
			sWork1 = strBrowVer.substring("Opera".length+1,
										  strBrowVer.length);
		}
		
		// - Use what is left to create the 'version' numbers		
		sWork1 = Trim(sWork1);
		var sWork2 = new String();
		// - Try to get version info out of leftover stuff
		nWork1 = sWork1.indexOf(" ");
		if (nWork1 >= 0)
		{
			sWork2 = sWork1.substring(0, nWork1);
			this.nVersion = sWork2.valueOf();
		}
		else
		{
			this.nVersion = sWork1.valueOf();
		}
		sWork2 = this.nVersion.toString();
		nWork1 = sWork2.indexOf(".");
		if (nWork1 >= 0)
		{
			this.nMajorVersion = sWork2.substring(0, nWork1).valueOf();
			this.nMinorVersion = (sWork2.substring((nWork1+1), sWork2.length).valueOf() * 0.01);
		}
		else
		{
			this.nMajorVersion = this.nVersion;
		}
	}
