// ##########################################################################
// #### MG: 2003-10-10 13:43
// #### MG: Script for checking the client browser
// ##########################################################################

// --------------------------------------------------------------------------
// #### MG: Global Variables
// --------------------------------------------------------------------------
var Netscape = new Boolean();
var IE = new Boolean();
var Opera = new Boolean();	
var Platform = new String();
var Version = new Number();
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// #### MG: The initial Methods are called
// --------------------------------------------------------------------------
InitializeDefaults();
CheckBrowser();
EvaluateBrowserResult();

//window.status = Version + " : " + navigator.appVersion + " : " + navigator.userAgent;
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// #### MG: Initial Methods
// --------------------------------------------------------------------------

// #### MG: Initializes the default values of the variables
function InitializeDefaults()
{
	Netscape = false;
	IE = false;
	Opera = false;
	Platform = navigator.platform;
	Version = 0;
}

// #### MG: Checks which kind of Internet Browser the user (client) is using	
function CheckBrowser()
{
	if(navigator.appName == "Netscape")
	{
		Netscape = true;
		GetBrowserVersion_Netscape();
	}
	else if(navigator.appName == "Microsoft Internet Explorer")
	{
		if(navigator.userAgent.indexOf("Opera") == -1)
		{
			IE = true;
			GetBrowserVersion_IE();			
		}
		else
		{
			Opera = true;
			GetBrowserVersion_Opera();
		}
	}
}

// #### MG: Gets the Version of the IE
function GetBrowserVersion_IE()
{
	Version = navigator.userAgent.substr(navigator.userAgent.indexOf("MSIE") + 5, 3);
}

// #### MG: Gets the Version of the Netscape Navigator
function GetBrowserVersion_Netscape()
{
	Version = navigator.userAgent.substr(navigator.userAgent.indexOf("Netscape") + 9, 3);
}

// #### MG: Gets the version of Opera
function GetBrowserVersion_Opera()
{
	Version = navigator.userAgent.substr(navigator.userAgent.indexOf("Opera") + 6, 3);
}

// #### MG: Displays a Popup-Window if Browser is not supported
function EvaluateBrowserResult()
{
	// #### MG: Ok, it's a Mac
	if(Platform.indexOf("Mac") != -1)
	{
		Popup_Mac();		
	}
	else // #### MG: It's not a Mac
	{
		if(Netscape)
		{
			if(Version < 6.2)
			{
				Popup_Netscape_OlderVersion();
			}
		}
		else if(Opera)
		{
			if(Version < 7.2)
			{
				Popup_Opera_OlderVersion();
			}
		}
		else if(IE)
		{
			if(Version < 5.0)
			{
				Popup_IE_OlderVersion();
			}			
		}
		else
		{
			Popup_Other();
		}
	}
}

// #### MG: Popup when client is using a Mac
function Popup_Mac()
{
	window.open("BrowserPopup2.htm","displayWindow2","toolbar=no,width=400,height=320,directories=no, status=no,scrollbars=no,resizable=no,menubar=no")
}

// #### MG: Popup when client is using an older Version of IE
function Popup_IE_OlderVersion()
{
	Popup_Other();	
}

// #### MG: Popup when client is using an older Version of Netscape Navigator
function Popup_Netscape_OlderVersion()
{
	Popup_Other();
}

// #### MG: Popup when client is using an Opera browser
function Popup_Opera_OlderVersion()
{
	Popup_Other();
}

// #### MG: Popup when client is using a different browser
function Popup_Other()
{
	window.open("BrowserPopup1.htm","displayWindow","toolbar=no,width=400,height=320,directories=no, status=no,scrollbars=no,resizable=no,menubar=no");
}
// --------------------------------------------------------------------------
