/*-------------------------------------------------------------
Author: David Edward Thomas
Company: Samurai Systems, Inc.
Date: July 22, 2003
-------------------------------------------------------------*/

var gminnetver = 5.0;
var gminiever = 4.0;
var gsess = new objSession();

/*-------------------------------------------------------------
	Define session object
-------------------------------------------------------------*/
function objSession()
{
	var vname = navigator.appName;
	var vver = navigator.appVersion;
	var vtype = 0;
	var vnv = Number(vver.substr(0, vver.indexOf('.')));
	if (vname.toLowerCase().indexOf('netscape') != -1) vtype =1;
	else if (vname.toLowerCase().indexOf('microsoft') != -1) vtype =2;
	// Browser test function
	function isnet()
	{
		if (vtype == 1) return true;
		else return false;
	}
	// Browser test function
	function isie()
	{
		if (vtype == 2) return true;
		else return false;
	}
	// Browser information
	function show()
	{
		var vs = 'Browser: ' + vname + '\nVersion: ' + vver;
		alert(vs);
	}
	// Compatibility test
	function iscompatible()
	{
		if (vtype == 1)
		{
			if (vnv < gminnetver) return false;
			else return true;
		}
		if (vtype == 2)
		{
			if (vnv < gminiever) return false;
			else return true;
		}
		return null;
	}
	//Is a Mac
	function ismac()
	{
		if (navigator.platform.indexOf('Mac') == 0)
			return true;
		else return false;
	}
	//Is a Win PC
	function iswin()
	{
		if (navigator.platform.indexOf('Win') == 0)
			return true;
		else return false;
	}	
	// Minimum version of browser allowed.
	function minver()
	{
		if (vtype == 1) return gminnetver;
		if (vtype == 2) return gminiever;
		else return null;
	}
	// Name of browser
	function name(){return vname;}
	// Function object properties
	this.isNetscape = isnet;
	this.isIE = isie;
	this.show = show;
	this.isCompatible = iscompatible;
	this.name = name;
	this.minVersion = minver;
	this.isMac = ismac;
	this.isWin = iswin;
	return this;	
}
/*-------------------------------------------------------------
	Define function to get an object, independent of the browser
-------------------------------------------------------------*/
function domObject(pobj, pname)
{
	var vobj;
	if (gsess.isIE())
	{
		if (pobj == null) vobj = document.all[pname];
		else vobj = pobj.document.all[pname];
	}
	else if (gsess.isNetscape() && gsess.isCompatible())
	{
		if (pobj == null) vobj = document.getElementById(pname);
		else vobj = pobj.document.getElementById(pname);
	}
	return vobj;
}
/*-------------------------------------------------------------
	Define a function to get the page name from the location
-------------------------------------------------------------*/
function pageName()
{
	var vs = window.location.href;
	var vx = vs.lastIndexOf('/');
	var vl = vs.length;
	vs = vs.substr(vx+1, vl - vx);
	vx = vs.lastIndexOf('.');
	vs = vs.substr(0, vx);
	return vs;
}
/*-------------------------------------------------------------
-------------------------------------------------------------*/
function navCurrent(pobj){ if (pobj.id.indexOf(pageName()) != -1) return true; else return false;}
function nav_over(pobj){if (!navCurrent(pobj)) pobj.className = 'navdivover';}
function nav_out(pobj){if (!navCurrent(pobj)) pobj.className = 'navdiv';}
function nav_click(pobj)
{
	if (!navCurrent(pobj))
	{
		var vs = '';
		switch (pobj.id)
		{
			case 'div_index':
				vs = 'index.html';
				break;
			case 'div_overview':
				vs = 'overview.html';
				break;
			case 'div_architecture':
				vs = 'architecture.html';
				break;
			case 'div_support':
				vs = 'support.html';
				break;
			case 'div_upgrade':
				vs = 'upgrade.html';
				break;
		}
		if (vs.length > 0) window.location = vs;
	}
}
function findCurrent()
{
	var vf = false;
	vf = current('div_index');
	if (!vf) vf = current('div_overview');
	if (!vf) vf = current('div_architecture');
	if (!vf) vf = current('div_support');
	if (!vf) vf = current('div_upgrade');
}
function current(pname)
{
	var vf = false;
	var vobj = domObject(null, pname);
	if (vobj == null) return vf;
	vf = navCurrent(vobj);
	if (vf) vobj.className = 'navdivhot';
	return vf;
}