/**
 * File: WhatPlatform.js
 * Determines which platform and which browser is executing this script.
 */

function whatPlatform()
{
   // Browser name string, major version, and agent string

	var name = navigator.appName;
	var ver = parseInt( navigator.appVersion );
	var agent = navigator.userAgent;
	var platform = navigator.platform;

	// Microsoft Internet Explorer and version
	this.msie     = ( agent.indexOf("MSIE") != -1 );
	this.msie4up  = ( this.msie && (ver >= 4) );  

	// Netscape Navigator and version
	this.ns = ( name.indexOf("Netscape") != -1 );
	this.ns4up = ( this.ns && (ver >= 4) );
	// Netscape 6 version is actually version 5.0 when getting the appVersion proterty.	
	this.ns6up = ( this.ns && (ver >= 5) );

	// Operating system, test both Netscape agent or MSIE agent strings.
	this.win95 = ((agent.indexOf("Win95")!=-1) || (agent.indexOf("Windows 95")!=-1));
	this.win98 = ((agent.indexOf("Win98")!=-1) || (agent.indexOf("Windows 98")!=-1));
	this.winnt = ((agent.indexOf("WinNT")!=-1) || (agent.indexOf("Windows NT 4")!=-1));
	this.win2k = ((agent.indexOf("WinNT")!=-1) || (agent.indexOf("Windows NT 5.0")!=-1));
	this.winxp = ((agent.indexOf("WinNT")!=-1) || (agent.indexOf("Windows NT 5.1")!=-1));
	this.win2k3 = ((agent.indexOf("WinNT")!=-1) || (agent.indexOf("Windows NT 5.2")!=-1));
	
	this.win = (agent.indexOf("Win") != -1);
		
	this.mac   = (agent.indexOf("Mac") != -1);
	this.sun   = (agent.indexOf("SunOS") != -1);
	this.linux = (agent.indexOf("Linux") != -1);
	this.os2 = (agent.indexOf("OS2") != -1) || (agent.indexOf("OS/2") != -1);

	this.ce    = (platform.indexOf("CE") != -1);
	this.ppc   = (agent.indexOf("PPC") != -1);

	// Look for the MRJ Plugin in Macintosh Netscape
	this.mrjPlugin = false;
	
	if ( this.mac && this.ns4up )
	{
		this.mrjPlugin = navigator.plugins["MRJ Java Plugin"] ? true : false;
	}
}

