//Note:These scripts are used to detect the browser, browser version, and platform, of the client computer.
//Note:Dependencies here they must execute in this order - used by other global scripts, and page specific scripts.
//Author: Tim Dunham 5/22/03

//generic object containing DOM properties
var objDom = new objDom();

function objDom() {
	this.isW3C = document.getElementById ? true : false;
	this.isMSIE4 = document.all ? true : false;
	this.isNN4 = document.layers ? true : false;
}

//generic object containing the x-browser properties of the navigator object
var objAgent = new objAgent();
function objAgent()
{
	this.userAgent = navigator.userAgent.toLowerCase();
	this.codeName = navigator.appCodeName.toLowerCase();
	this.name = navigator.appName.toLowerCase();
	this.version = navigator.appVersion.toLowerCase();
	this.platform = navigator.platform.toLowerCase();
	this.plugins = navigator.plugins; //array
}

//client object variables
var strApplication  = getApplication();
var strApplicationMinor = getApplicationMinor();
var strPlatform = getPlatform();
var intAppVersion = getVersion();

//client object for generic client description
var objClient = new objClient();

function objClient()
{
	//calculate the application being used
	this.application = strApplication;
	//calculate the Minor application being used
	this.applicationMinor = strApplicationMinor;
	//calculate the platform being used
	this.platform = strPlatform;
	//calculate the version being used
	this.version = intAppVersion;
}

//client object for specific client description
var objBrowser = new objBrowser();

function objBrowser()
{
	//windows
	this.bWinIE4 = ((objClient.platform == "win") && (objClient.application == "ie") && (objClient.version == "4")) ? true : false;
	this.bWinIE5 = ((objClient.platform == "win") && (objClient.application == "ie") && (objClient.version == "5")) ? true : false;
	this.bWinIE6 = ((objClient.platform == "win") && (objClient.application == "ie") && (objClient.version == "6")) ? true : false;
	this.bWinIE7 = ((objClient.platform == "win") && (objClient.application == "ie") && (objClient.version == "7")) ? true : false;
	this.bWinNN6 = ((objClient.platform == "win") && (objClient.application == "nn") && (objClient.version >= 5)) ? true : false;
	this.bWinNN4 = ((objClient.platform == "win") && (objClient.application == "nn") && (objClient.version == "4")) ? true : false;
	this.bWinAOL = ((objClient.platform == "win") && (objClient.applicationMinor == "aol")) ? true : false;
	this.bWinOP = ((objClient.platform == "win") && (objClient.applicationMinor == "op")) ? true : false;
	//mac
	this.bMacIE4 = ((objClient.platform == "mac") && (objClient.application == "ie") && (objClient.version == "4")) ? true : false;
	this.bMacIE5 = ((objClient.platform == "mac") && (objClient.application == "ie") && (objClient.version == "5")) ? true : false;
	this.bMacNN6 = ((objClient.platform == "mac") && (objClient.application == "nn") && (objClient.version >= 5)) ? true : false;
	this.bMacNN4 = ((objClient.platform == "mac") && (objClient.application == "nn") && (objClient.version == "4")) ? true : false;
	this.bMacAOL = ((objClient.platform == "mac") && (objClient.applicationMinor == "aol")) ? true : false;
	this.bMacOP = ((objClient.platform == "mac") && (objClient.applicationMinor == "op")) ? true : false;
	this.bMacSA = ((objClient.platform == "mac") && (objClient.applicationMinor == "safari")) ? true : false;
}


//calculate the application
function getApplication()
{
	var strApp;

	if (objAgent.name.indexOf("microsoft") != -1)
	{
		strApp = "ie";
	}
	else if (objAgent.name.indexOf("netscape") != -1)
	{
		strApp = "nn";
	}
	else
	{
		strApp = "ie";
	}
	return strApp;
}

//calculate the Minor application
function getApplicationMinor()
{
	var strAppMinor;

	if (objAgent.userAgent.indexOf("opera") != -1)
	{
		strAppMinor = "op";
	}
	else if (objAgent.userAgent.indexOf("aol") != -1)
	{
		strAppMinor = "aol";
	}
	else if (objAgent.userAgent.indexOf("safari") != -1)
	{
		strAppMinor = "safari";
	}
	else
	{
		strAppMinor = false;
	}
	return strAppMinor;
}

//calculate the platform
function getPlatform()
{
	var strPlat;

	if (objAgent.platform.indexOf("win") != -1)
	{
		strPlat = "win";
	}
	else if ((objAgent.platform.indexOf("mac") != -1) || (objAgent.platform.indexOf("ppc") != -1))
	{
		strPlat = "mac";
	}
	else
	{
		strPlat = "win";
	}
	return strPlat;
}

//calculate the version of the application
function getVersion()
{
	var intApp;

	intApp = parseInt(objAgent.version);
	//IE4
	if ((strApplication == "ie") && (objAgent.userAgent.indexOf("msie 4") != -1))
	{
		intApp = 4;
	}
	//IE5
	else if ((strApplication == "ie") && (objAgent.userAgent.indexOf("msie 5") != -1))
	{
		intApp = 5;
	}
	//IE6
	else if ((strApplication == "ie") && (objAgent.userAgent.indexOf("msie 6") != -1))
	{
		intApp = 6;
	}
	//IE6
	else if ((strApplication == "ie") && (objAgent.userAgent.indexOf("msie 7") != -1))
	{
		intApp = 7;
	}
	//NN6
	else if ((strApplication == "nn") && ((objAgent.userAgent.indexOf("gecko") != -1) || (intApp >= 5)))
	{
		intApp = 6;
	}
	else
	{
		intApp = 4;
	}
	return intApp;
}