
	//===============================================================================
	//	FUNCTION:	FSS_CookiesDetect
	// 
	//	INPUT: 		<nothing>
	//
	//	RETURN:		Can we update / read cookies from this browser ?
	//				( True; False; )
	//
	//	DESC:		This function is used with client-side JavaScript to detect
	//				if we can update / read cookies on this 'User' browser.
	//
	//	PLATFORMS:	Netscape Navigator 3.01 and higher,
	//			  	Microsoft Internet Explorer 3.02 and higher,
	//===============================================================================
	function FSS_CookiesDetect()
	{
		var bRtrn = false;

		// Test whether the user accepts cookies.
		if (document.cookie == '')
		{
			// - Try to set a cookie
			document.cookie = 'FSS_AcceptsCookies=yes';
			if (document.cookie.indexOf('FSS_AcceptsCookies=yes') != -1)
			{
				bRtrn = true; 
			} // If it succeeds, set variable
		}
		else
		{
			// - there was already a cookie
			bRtrn = true;
		}

		return (bRtrn);
	}

	//===============================================================================
	//	FUNCTION:	FSS_SetCookie
	// 
	//	INPUT: 		strName (String)	- Name of the 'cookie' to store.
	//				strValue (String)	- Value of the 'cookie' to store.
	//				varHours (String)	- Time stamp, if 'string' then parse,
	//												  if 'number' then calculate.
	//				strPath (String)	- Path to 'stamp' the cookie with.
	//				strDomain (String)	- Domain to 'stamp' the cookie with.
	//				bSecure (Bool)		- Is this a secure cookie of not ?
	//
	//	RETURN:		Did we update the cookie for this browser ?
	//				( True; False; )
	//
	//	DESC:		This function is used with client-side JavaScript to 
	//				set 'Cookies' information.
	//
	//	PLATFORMS:	Netscape Navigator 2.0 and higher,
	//			  	Microsoft Internet Explorer 3.02 and higher,
	//===============================================================================
	function FSS_SetCookie(strName, strValue, varHours, strPath, strDomain, bSecure)
	{
		var bRtrn = false;
	
		// - Don't waste your time if the browser doesn't accept cookies.
		if (FSS_CookiesDetect())
		{
			// - Check for 'Netscape Navigator' version 2.0
			var not_NN2 = (navigator &&
						   navigator.appName &&
						   (navigator.appName == 'Netscape') && 
						   navigator.appVersion &&
						   (parseInt(navigator.appVersion) == 2)) ? false : true;

			// - Special case logic
			if (varHours && not_NN2)
			{
				// - NN2 cannot handle Dates, so skip this part
				if ((typeof(varHours) == 'string') &&
					 Date.parse(varHours))
				{
					// - Already a Date string
					var numHours = varHours;
				}
				else if (typeof(varHours) == 'number')
				{
					// - Calculate Date from number of hours
					var numHours = (new Date((new Date()).getTime() + varHours * 3600000)).toGMTString();
				}
			}

			// - Check the validity of the expires stamp
			bRtrn = ((varHours && not_NN2 && !(numHours)) ?  false : true);

			// - Set the cookie, adding any parameters that were specified.
			if (bRtrn) then
			{
				document.cookie = strName + '=' + 
								  escape(strValue) + 
								  ((numHours) ? (';expires=' + numHours) : '') +
								  ((strPath) ? ';path=' + strPath : '') +
								  ((strDomain) ? ';domain=' + strDomain : '') + 
								  ((bSecure && (bSecure == true)) ? '; secure' : '');
			}								  
		}
		
		return (bRtrn);
	}

	//===============================================================================
	//	FUNCTION:	FSS_ReadCookie
	// 
	//	INPUT: 		strName (String)	- Name of the 'cookie' to read.
	//
	//	RETURN:		The value of the read 'cookie'.
	//				(String) <Blank = no cookie || value>
	//
	//	DESC:		This function is used with client-side JavaScript to 
	//				read 'Cookies' information.
	//
	//	PLATFORMS:	Netscape Navigator 2.0 and higher,
	//			  	Microsoft Internet Explorer 3.02 and higher,
	//===============================================================================
	function FSS_ReadCookie(strName)
	{
		var sRtrn = "";

		// Any cookies present to read ?
		if (document.cookie != '')
		{
			// There is a cookie
			var firstChar, lastChar;
			var strCookie = document.cookie;
			// Find the start of 'name'
			firstChar = strCookie.indexOf(strName);
			var NN2Hack = firstChar + strName.length;
			if ((firstChar != -1) &&
				(strCookie.charAt(NN2Hack) == '='))
			{
				// If you found the cookie
				// skip 'name' and '='
				firstChar += strName.length + 1;
				// Find the end of the value string (i.e. the next ';').
				lastChar = strCookie.indexOf(';', firstChar);
				if (lastChar == -1) lastChar = strCookie.length;
				sRtrn = unescape(strCookie.substring(firstChar, lastChar));
			}
		}	

		return (sRtrn);
	}

	//===============================================================================
	//	FUNCTION:	FSS_KillCookie
	// 
	//	INPUT: 		strName (String)	- Name of the 'cookie' to kill.
	//				strPath (String)	- Path of the cookie 'stamp'.
	//				strDomain (String)	- Path of the cookie 'stamp'.
	//
	//	RETURN:		Did we kill the cookie of not ?
	//				(True/False).
	//
	//	DESC:		This function is used with client-side JavaScript to 
	//				kill an existing 'Cookie' value.
	//
	//	PLATFORMS:	Netscape Navigator 2.0 and higher,
	//			  	Microsoft Internet Explorer 3.02 and higher,
	//===============================================================================
	function FSS_KillCookie(name, path, domain)
	{
		var bRtrn = false;

		// We need the value to kill the cookie
		var strValue = FSS_ReadCookie(strName);
		if (strValue)
		{
			// Set an already-expired cookie
			document.cookie = strName + '=' + strValue +
							 ';expires = Fri, 13-Apr-1970 00:00:00 GMT' +
							 ((strPath) ? ';path = ' + strPath : '') +
							 ((strDomain) ? ';domain=' + strDomain : '');

			bRtrn = true;
		}
		
		return (bRtrn);
	}
