////////// detect.js //////////////////////////////////////////////////
//
//  Figure out which 
//		- platform is used 
//		- browser is used
//		- viewers are available
//
//  This script returns the following variables:

var WindowsPC         = "FALSE";  // [TRUE/FALSE] OS is windows ?
var Macintosh         = "FALSE";  // [TRUE/FALSE] OS is Macintosh ?

var Netscape          = "FALSE";  // [TRUE/FALSE] Browser is Netscape ?
var Explorer          = "FALSE";  // [TRUE/FALSE] Browser is Explorer ?
var NetscapeVersionSupported = "TRUE";	// [TRUE/FALSE] Browser is supported ?	

var MapGuideControl   = "FALSE";  // [TRUE/FALSE] MapGuide Control usable ?
var MapGuidePlugin    = "FALSE";  // [TRUE/FALSE] MapGuide Plugin installed ?

// Note: navigator.appVersion on Win98 will show up as "Win95"
////////////////////////////////////////////////////////////////////////

if ((navigator.appVersion.indexOf("WinNT")   != -1) ||
    (navigator.appVersion.indexOf("Win95")   != -1) ||
    (navigator.appVersion.indexOf("Win98")   != -1) ||
    (navigator.appVersion.indexOf("Windows") != -1))
{
	WindowsPC = "TRUE";
	if (navigator.appName.indexOf("Netscape") != -1)
	{
		Netscape = "TRUE";						// Plugin will be used
		if (navigator.plugins && navigator.plugins["Autodesk MapGuide"])
		{
			MapGuidePlugin = "TRUE";
			//alert('MapGuidePlugin found');
		}
	}
	else if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1)
	{
		Explorer = "TRUE";						// ActiveX viewer will be used
		// IE won't tell us if the control is installed, so we just assume
		// that either it is or that it can be downloaded on demand.
		// We can check later if it is loaded with getMap().readystate
		MapGuideControl = "TRUE";
	}
}
else // Macintosh and others					// Java Applet viewer will be used
{									
	if (navigator.appVersion.indexOf("Macintosh") != -1)
		Macintosh = "TRUE";	
	if (navigator.appName.indexOf("Netscape") != -1)
		Netscape = "TRUE";
	else if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1)
		Explorer = "TRUE";
}
if  (
	(Netscape == "TRUE") && (navigator.appVersion.indexOf("4.") != 0))
{
	NetscapeVersionSupported = "FALSE";
	alert("Sorry, the Netscape browser is only supported up to 4.7 in this version. \n You will not be able to use the toolbar, use right click for zooming.");
}
