/*
 * This is an integration of the external dhtml code with the IMS produced dhtml code.
 * Some "touch up" work / "torqueing" was done on the external code.
 * 1/8/2002
 */

//--------------------------------------------------------------------------------
//  Filename: common.js
//	Author: Scott Baldwin, Axis 41
//	Last Modified: 07.17.2001
//	
//	Global variables.
//	Functions.
//		browserCheck() - object to determine browser
//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
// Global Variables
//--------------------------------------------------------------------------------

var is = new browserCheck();

//--------------------------------------------------------------------------------
// Functions
//--------------------------------------------------------------------------------

function browserCheck() {
  var b = navigator.appName;
  if (b=="Netscape") {
    this.b = "ns";
  } else if (b=="Microsoft Internet Explorer") {
    this.b = "ie";
  } else {
    this.b = b;
  }
  this.version = navigator.appVersion;
  this.v = parseInt(this.version);
  this.ns = (this.b=="ns" && this.v>=4);
  this.ns4 = (this.b=="ns" && this.v==4);
  this.ns5 = (this.b=="ns" && this.v==5);
  this.ie = (this.b=="ie" && this.v>=4);
  this.ie4 = (this.version.indexOf('MSIE 4')>0);
  this.ie5 = (this.version.indexOf('MSIE 5')>0);
  this.min = (this.ns||this.ie);
}

//--------------------------------------------------------------------------------
//  Filename: menu.js
//	Author: Scott Baldwin, Axis 41
//	Last Modified: 05.17.2001
//	
//	Global variables.
//		myLink - take a link passed from the left nav menu to link up whole rollover
//	Functions.
//		handler(e) - captures the mousedown event on the window for nav rollover
//		setLinkNull() - set myLink to empty char
//		setLink(menuLink) - sets myLink = menuLink if netscape for nav rollover workaround
//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
// Global Variables
//--------------------------------------------------------------------------------

var myLink;

if (is.ns4)
{
	//	window.captureEvents(Event.MOUSEDOWN);
	//	window.onmousedown = handler;
}

//--------------------------------------------------------------------------------
// Functions
//--------------------------------------------------------------------------------

function handler(e)
{
	if (myLink)
	{
		location.href = myLink;
		return false;
	}
}

function setLinkNull()
{
	myLink = '';
}

function setLink(menuLink)
{
	myLink = menuLink;
}

//--------------------------------------------------------------------------------
// Functions from outside, reworked to use IMS stuff
// These functions control the events related to showing and hiding layers.
//--------------------------------------------------------------------------------

// -- Called on mouseover of TDs on SNLs
// Keep SNL visible, restore SNL TD's color, and popup TNL
function subNavShow(terID, main)
{
	// Name of secondary level layer
	var secID = terID.charAt(0) + terID.charAt(1);

	// Keep SNL visible
	showlayer(secID);

	// Make selected TNL visible
	showlayer(terID);

	return(bgActive);
}

// -- Called on mouseover of TDs on TNLs
function subOver(menuLink)
{
	// Keep everything visible (only clears timer, if there's a timer to be cleared)
	killtimer();

	// Reset netscape link
	if (is.ns)
	{
		// setLink(menuLink);
	}
  
	return(bgActive);
}

// -- Called on mouseout of TDs
function subOut(snl)
{
	hideslowly(snl);

	// Reset Netscape link
	if (is.ns)
	{
		// setLinkNull();
	}

	return(bgNormal);
}

//--------------------------------------------------------------------------------
// ddhtml-scripts.js
//
// Javascript functions used by dDHTML.
//--------------------------------------------------------------------------------

var thetimer;						// Global timer variable for popups
var timerDelay = 75;				// The number of millisecs to delay setTimeout activities
var tempname;						// Temp var for layer name (setTimeout requires it in hideslowly())
var n6loc;							// Temp variable for layer name (setTimeout requires it)

function hidelayer(thelayer)
{
	var hidestring;

	if (is.ns4)
	{
		hidestring = "document." + thelayer + ".visibility = \"hide\"";
	}
	else if (is.ns5)
	{
		n6loc = document.getElementById(thelayer);
		n6loc.style.visibility = "hidden";
	}
	else
	{
		hidestring = thelayer + ".style.visibility = \"hidden\"";
	}

	if ((is.ie) || (is.ns4))
	{
		eval(hidestring);
	}
}

function showlayer(layername)
{
	var showstring;

	if (is.ns4)
	{
		showstring = "document." + layername + ".visibility = \"show\"";
	}
	else if (is.ns5)
	{
		n6loc = document.getElementById(layername);
		n6loc.style.visibility = "visible";
	}
	else
	{
		showstring = layername + ".style.visibility = \"visible\"";
	}

	if ((is.ie) || (is.ns4))
	{
		eval(showstring);
	}
}

function hidealllayers()
{
	for (var i = 0; i < sectlayers.length; i++)
	{
		hidelayer(sectlayers[i]);
	}
}

function popupLayer(thelayer)
{
	tempname = thelayer;
	hidealllayers();
	setTimeout('showlayer(tempname)', timerDelay);
}

function hideslowly(thelayer, img, newimg)
{
	tempname = thelayer;
	tempimg = img;
	tempnewimg = newimg;

	if (is.ns5)
	{
		n6loc = document.getElementById(thelayer);
		thetimer = setTimeout('n6loc.style.visibility = "hidden";', timerDelay);
	}
	else
	{
		thetimer = setTimeout('hidelayer(tempname);', timerDelay);
	}
}

function killtimer()
{
	if (thetimer)
	{
		clearTimeout(thetimer);
	}
}
