<!--
// Name:	browser.js
// Author:	Dave Walker
//		(c) Copyright Dave Walker, 2005. All rights reserved.
// Date:	22nd November 2005
// Purpose:	Browser detection and browser-specific methods
//
// Modification Record:
// DD/MM/YY	Name		Comments
// 22/11/05	Dave Walker	First Version Written

// Name:    	DetectBrowser
// Author:  	Dave Walker
//		(c) Copyright Dave Walker, 2005. All rights reserved.
// Date:    	22nd November 2005
// Purpose: 	Detect the current browser

function DetectBrowser()
{
	var strBrowserName;
	var strUserAgent;

	// Initialise the browser name
	strBrowserName = '';

	// Make sure we have a reference to the navigator object
	if ( navigator )
	{
		// Browser	Returns
		// Firefox	A string containing "Gecko" and "Firefox"
		// Netscape	A string containing "Gecko" and "Netscape"
		// Opera	A string containing the text "Opera"

		if ( navigator.userAgent )
		{
			// Get the HTTP user agent string
			strUserAgent = navigator.userAgent.toLowerCase();
			
			// See if we're Firefox or Opera
			if ( strUserAgent.indexOf( 'opera' ) != -1)
			{
				strBrowserName = 'opera';
			}
			else if ( strUserAgent.indexOf( 'firefox' ) != -1)
			{
				strBrowserName = 'firefox';
			}
		}

		// Browser	Returns
		// Firefox	Netscape
		// IE		Microsoft Internet Explorer
		// Netscape	Netscape
		// Opera	Microsoft Internet Explorer

                if ( strBrowserName == '' )
                {
			strBrowserName = navigator.appName.toLowerCase();
		}
	}
	else
	{
		// Default to IE
		strBrowserName = 'microsoft internet explorer';
	}
	
	// Return the browser name
	return strBrowserName;
}

// Name:    	NavigateToURL
// Author:  	Dave Walker
//		(c) Copyright Dave Walker, 2005. All rights reserved.
// Date:    	22nd November 2005
// Purpose: 	Navigate to a specified URL

function NavigateToURL( pstrURL )
{
	// Detect the browser and either use window.navigate() or window.location
	strBrowserName = DetectBrowser();
	if ( strBrowserName == 'netscape' || strBrowserName == 'firefox' )
	{
		window.location = pstrURL;
	}
	else
	{
		window.navigate( pstrURL );
	}
}

-->
