// Set up some generic utility functions that can be used by all scripts

function getObj(id) 
{
	// Get a reference to an object
	// Check for DOM-compliant browsers (MSIE5, NSN6, O5), then MSIE 4, then NN4, then non-DHTML browsers	
    if (document.getElementById) {return document.getElementById(id);}
	else if (document.all) 		 {return document.all[id];}
	else if (document.layers)    {return document.layers[id];}
	else 						 {return false;}
}

function getStyleObj(id) 
{
	// Get a reference to the style for an object
	// Check for DOM-compliant browsers (MSIE5, NSN6, O5) or MSIE 4, then NN4
    if (document.getElementById || document.all) {return getObj(id).style;} 
	else {return getObj(id);}
}

// Handle need for Netscape's href attribute
function doNothing(){}

// External window control
function externalWindow(url) 
{
	if (is_nav)
	{
		extWindow = window.open(url, 'wndMain','width=620,height=350,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=1,location=1')
		extWindow.focus()
	}
	else
	{		
		extWindow = window.open(url, 'wndMain','width=420,height=350,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=1,location=1')
		extWindow.focus()
	}	
}


// The following cookie functions are only used for Windows Netscape 4 users
function getCookie(name) 
{ 
	// Check for cookie 
	var index = document.cookie.indexOf(name + "=");
    if (index == -1) return null;

	// Extract the cookie
	index = document.cookie.indexOf("=", index) + 1;
	var endstr = document.cookie.indexOf(";", index);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(index, endstr));
}

function setCookie (name, value)
{
	var path = "/";
	document.cookie = name + "=" + escape (value) + "; path=" + path;
}

// Indicate that this script is loaded for preload page or write out the tag for the next script on all other pages
if ((thisSection == 99) && (thisSubSection == 99))
{
	// Show that this script has loaded
  	var showLoaded = getStyleObj("loader0");
   	showLoaded.visibility = 'visible';
	
	// Call up the next script to preload by writing out the tag to the html page
	document.write("<script type=\"text/javascript\" language=\"JavaScript\" src=\"js/styles.js\"></script>");
}
else
{
	// If the user if Win Netscape 4, check to see if redirection is necessary
	// Redirection is necessary if the cookie returns null
	if (win_net_bug)
	{
		// Check for a cookie
		var apalCookie02 = getCookie("apalCookie02");
	
		// Check for redirect
		if (apalCookie02 == null)
		{
			// Set the cookie then navigate to the warning page
			setCookie ("apalCookie02", "apalCookie02");
			window.location = "../home/windows_netscape4.shtml"
		}
	}

	// Call up the next script to actually use by writing out the tag to the html page
	document.write("<script type=\"text/javascript\" language=\"JavaScript\" src=\"../js/menuArr.js\"></script>");
}