// GLOBAL FUNCTIONS

// SUPRESS JS ERRORS - COMMENT OUT TO TEST SCRIPTS
	
function errorsuppressor(){
return true
}

window.onerror=errorsuppressor

// BODY ONLOAD UTILITY (SUPPORTS MULTIPLE ONLOAD FUNCTIONS)

// BROWSER DETECTION

isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

var gSafeOnload = new Array();

function SafeAddOnload(f) {
	
	if (IEmac && IE4)  // IE 4.5 blows out on testing window.onload
	{
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = f;
	}
	else if  (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}
function SafeOnload()
{
	for (var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}

// NAV SCRIPT FOR IE5/6
// PSUEDO CLASSES CANNOT BE APPLIED TO ELEMENTS (OTHER THAN ANCHORS) IN IE, SO WE NEED TO FORCE IT

iehover = function() {

	var sfEls = document.getElementById("subnav").getElementsByTagName("LI");
	
	for (var i=0; i<sfEls.length; i++) {
	
		sfEls[i].onmouseover=function() {
		this.className+=" iehover";
		}
	
		sfEls[i].onmouseout=function() {
		this.className=this.className.replace(new RegExp(" iehover\\b"));
		}

	}
}

if (window.attachEvent) window.attachEvent("onload", iehover);


// ACCESSIBILITY/NOJS POPUP

// CHECK DOC FOR CSS CLASS CALLED "POPUPWINDOW"
//IF IT EXISTS, APPLY ONCLICK EVENT HANDLER 

function newWinLinks() {

	for (var i=0; i<document.links.length; i++) {
		if (document.links[i].className == "popupwindow") {
			document.links[i].onclick = displayWindow;
		}
	} 
}

SafeAddOnload(newWinLinks);

// DE POPUP FUNCKY-TION

// WIDTH & HEIGHT ARE SET TO DEFAULT POPUP SIZE. SET THE ACTUAL SIZE IN THE HREF QUERYSTRING, AND USE WINDOW.RESIZE IN THE TARGET PAGE.
// THE MAY SEEM LIKE A BIT TO DO BUT IT IS BETTER FOR ACCESSIBILITY.

function displayWindow() {

	var pageWindow = window.open(this.href,"win", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,top=375,left=325,width=620,height=540');
	
	// SET FOCUS ON TARGET WINDOW
	
	pageWindow.focus();
	
	// KILL HREF BEFORE POPUP IS FIRED OFF
	
	return false;
}

// SPELL



