// Returns the Microsoft scripting version.
function GetScriptEngineInfo()  {
    var sEngine = "Unknown"; // Build string with necessary info.
    sEngine = ScriptEngine() + " Version ";
    sEngine += ScriptEngineMajorVersion() + ".";
    sEngine += ScriptEngineMinorVersion() + ".";
    sEngine += ScriptEngineBuildVersion();
    return(sEngine);
}

function GetBrowserVersion() {
// Purpose:
//	Creates an object that contains the properties of the current browser
// Properties:
//	BrowserName: The brand name of the browser
//	MajorVersion: The browser's major version number
//	MinorVersion: The browser's minor version number
//	JSVersion: The browser's supported Javascript version
//	Platform: The user's operating system
//	PlatformVersion: The user's operating system version
//	PlatformArchitecture: The maximum supported bit-width of the platform
// Author:
//	Bob Herguth 2000 (OS platform checks are based on public code)
// Prototypes:
//	var oBr = new GetBrowserVersion()
//	alert(oBr.BrowserName + " v" + oBr.MajorVersion + "." + oBr.MinorVersion)
//	alert(navigator.userAgent.toLowerCase())
//	alert("Javascript v" + oBr.JSVersion)
//	alert(oBr.Platform + " " + oBr.PlatformVersion)
//	alert(oBr.PlatformArchitecture)
// Notes:
//	The object should be instanciated after this function is compiled.
//
    var sAgent = navigator.userAgent.toLowerCase()

	// Determine the browser name
	if ((sAgent.indexOf('mozilla')!=-1) && ((sAgent.indexOf('spoofer')==-1) && (sAgent.indexOf('compatible') == -1)))
		this.BrowserName = "Netscape Navigator"
	else if (sAgent.indexOf("msie") != -1)
		this.BrowserName = "Microsoft Internet Explorer"
	else if (sAgent.indexOf("opera") != -1)
		this.BrowserName = "Opera"

	// Determine the browser version
	this.MajorVersion = parseInt(navigator.appVersion)
	this.MinorVersion = parseFloat(navigator.appVersion)
	if (this.BrowserName == "Microsoft Internet Explorer") {
		// MajorVersion returns the compatible version in MS IE
		//	w/o the following correction code.
		iMSIEVersionLoc = sAgent.indexOf("msie ", 1) + "msie ".length
		sMSIEVersionNumber = sAgent.substring(iMSIEVersionLoc, sAgent.indexOf(";", iMSIEVersionLoc))
		this.MajorVersion = parseFloat(sMSIEVersionNumber.substring(0, sMSIEVersionNumber.indexOf(".")))
		iMSIEMinorLoc = sMSIEVersionNumber.indexOf(".") + 1
		this.MinorVersion = (iMSIEMinorLoc > 0) ? parseFloat(sMSIEVersionNumber.substring(iMSIEMinorLoc)) : 0
	}

	// Determine Javascript spec supported
	if (this.BrowserName == "Microsoft Internet Explorer")
		this.JSVersion = (this.MajorVersion >= 4) ? 1.2 : 1.0
	else if (this.BrowserName == "NetScape Navigator" && this.MajorVersion == 2)
		this.JSVersion = 1.0
	else if (this.BrowserName == "NetScape Navigator")
		this.JSVersion = (this.MajorVersion >= 4) ? 1.2 : 1.1
	else
		this.JSVersion = 0.0

	// Determine OS Platform
	this.Platform = "Unknown"
	this.PlatformVersion = ""
	this.PlatformArchitecture = ""
	if (sAgent.indexOf("win")!=-1 || sAgent.indexOf("16bit")!=-1 || sAgent.indexOf("32bit")!=-1)
		this.Platform = "Microsoft Windows"
	else if ((sAgent.indexOf("os/2")!=-1) || (navigator.appVersion.indexOf("OS/2")!=-1) || (sAgent.indexOf("ibm-webexplorer")!=-1))
		this.Platform = "IBM OS/2"
	else if (sAgent.indexOf("mac")!=-1)
		this.Platform = "Apple Macintosh"
	else if (sAgent.indexOf("sunos")!=-1)
		this.Platform = "Sun Microsystems SunOS"
	else if (sAgent.indexOf("irix")!=-1)
		this.Platform = "Silicon Graphics"
	else if (sAgent.indexOf("hp-ux")!=-1)
		this.Platform = "HP/UX"
	else if (sAgent.indexOf("aix")!=-1)
		this.Platform = "IBM/AIX"
	else if (sAgent.indexOf("inux")!=-1)
		this.Platform = "Linux"
    else if (sAgent.indexOf("sco")!=-1 || sAgent.indexOf("unix_sv")!=-1)
		this.Platform = "SCO"
	else if (sAgent.indexOf("unix_system_v")!=-1)
		this.Platform = "UnixWare"	// AT&T, Novell, SCO
	else if (sAgent.indexOf("ncr")!=-1)
		this.Platform = "MPRAS"		// NCR Unix SVR4
	else if (sAgent.indexOf("reliantunix")!=-1)
		this.Platform = "Reliant"	// Fujitsu/Siemens
	else if (sAgent.indexOf("sinix")!=-1)
		this.Platform = "SINIX"		// Fujitsu/Siemens
	else if (sAgent.indexOf("dec")!=-1 || sAgent.indexOf("osf1")!=-1 || sAgent.indexOf("dec_alpha")!=-1 || sAgent.indexOf("alphaserver")!=-1 || sAgent.indexOf("ultrix")!=-1 || sAgent.indexOf("alphastation")!=-1)
		this.Platform = "DEC"
	else if (sAgent.indexOf("freebsd")!=-1)
		this.Platform = "Free BSD"
	else if (sAgent.indexOf("bsd")!=-1)
		this.Platform = "BSD"
	else if (sAgent.indexOf("vax")!=-1 || sAgent.indexOf("openvms")!=-1)
		this.Platform = "DEC VAX"
	else if (sAgent.indexOf("x11")!=-1)
		this.Platform = "UNIX"
	
	// Microsoft Windows Version
	if ((sAgent.indexOf("win95")!=-1) || (sAgent.indexOf("windows 95")!=-1)) {
		this.PlatformVersion = "95"
		this.PlatformArchitecture = "Win32"
	} else if ((sAgent.indexOf("win98")!=-1)||(sAgent.indexOf("windows 98")!=-1)) {
		this.PlatformVersion = "98"
		this.PlatformArchitecture = "Win32"
	} else if ((sAgent.indexOf("winnt")!=-1)||(sAgent.indexOf("windows nt")!=-1)) {
		this.PlatformVersion = "NT"
		this.PlatformArchitecture = "Win32"
	} else if ((sAgent.indexOf("win16")!=-1) || (sAgent.indexOf("16bit")!=-1) || (sAgent.indexOf("windows 3.1")!=-1) || (sAgent.indexOf("windows 16-bit")!=-1)) {
		this.PlatformVersion = "3.1x"
		this.PlatformArchitecture = "Win16"
	} else if (this.MajorVersion >= 4 && (navigator.platform == "Win32" || sAgent.indexOf("win32")!=-1 || sAgent.indexOf("32bit")!=-1))
		this.PlatformArchitecture = "Win32"
	
	// Apple Macintosh Version
    if (this.Platform == "Apple Macintosh" && ((sAgent.indexOf("68k")!=-1) || (sAgent.indexOf("68000")!=-1))) {
		this.PlatformVersion = ""
		this.PlatformArchitecture = "Motorolla 68000"
	} else if (this.Platform == "Apple Macintosh" && ((sAgent.indexOf("ppc")!=-1) || (sAgent.indexOf("powerpc")!=-1))) {
		this.PlatformVersion = ""
		this.PlatformArchitecture = "Motorolla PowerPC"
	}

	// Sun Microsystems Version
    if (sAgent.indexOf("sunos 4")!=-1) {
		this.PlatformVersion = "4"
		this.PlatformArchitecture = ""
	} else if (sAgent.indexOf("sunos 5")!=-1) {
		this.PlatformVersion = "5"
		this.PlatformArchitecture = ""
	} else if (this.Platform == "Sun Microsystems SunOS" && sAgent.indexOf("i86")!=-1) {
		this.PlatformVersion = "I86"
		this.PlatformArchitecture = "Intel x86"
	}
	
	// Silicon Graphics
	if (sAgent.indexOf("irix 5") !=-1)
		this.PlatformVersion = "5"
	else if ((sAgent.indexOf("irix 6") !=-1) || (sAgent.indexOf("irix6") !=-1))
		this.PlatformVersion = "6"

	// Hewlett Packard
	if (this.Platform == "HP/UX" && sAgent.indexOf("09.")!=-1)
		this.PlatformVersion = "9"
	else if (this.Platform == "HP/UX" && sAgent.indexOf("10.")!=-1)
		this.PlatformVersion = "10"

	// IBM
	if (sAgent.indexOf("aix 1")  !=-1)
		this.PlatformVersion = "1"
	if (sAgent.indexOf("aix 2")  !=-1)
		this.PlatformVersion = "2"
	if (sAgent.indexOf("aix 3")  !=-1)
		this.PlatformVersion = "3"
	if (sAgent.indexOf("aix 4")  !=-1)
		this.PlatformVersion = "4"
}

function InstallBrowser() {
// Purpose:
//	Installs an upgraded version of the browser for the user.
//
	var oShellExec = new ActiveXObject("ClientExecutor.ClientExec")
	// Backup User Favorites to avoid potential data loss with v4 to v5 upgrade
	//oShellExec.ExecProgram("\\<%=Application("sFileServer")%>\repair$\favback.exe", "Open")
	//oShellExec.ExecProgram("\\\\proton\\ie5\\ie5setup.exe", "Open")
}


// Global Variables
var oBr = new GetBrowserVersion()
var isNetscape = (oBr.BrowserName == "Netscape Navigator") ? true : false
var isExplorer = (oBr.BrowserName == "Microsoft Internet Explorer") ? true : false
var isOther = ((!isExplorer && !isNetscape) || (oBr.MajorVersion <= 3)) ? true : false
