// ##################
// Browser Detection
// ##################

// Note: Browser detection may be outside this file if
// site is heavily JS driven and different JS files are
// loaded for each browser (e.g. separate DOM / NS / IE
// files)

DOM = (document.getElementById) ? true : false;
NS4 = (document.layers) ? true : false;						//Netscape 4 specifically
NS6 = (!document.all && document.getElementById) ? 1 : 0;	//Netscape 6 & 7
IE = (document.all) ? true : false;							//Any IE
IE4 = IE && !DOM;											//IE4 specifically
IE5 = (IE4 && navigator.appVersion.indexOf("5.") != -1);	//Any IE 5 series
IE50 = (navigator.appVersion.indexOf("MSIE 5.0") != -1);	//IE5.0 specifically
ver4 = (NS4 || IE4 || DOM);									//Version 4 or ABOVE
isMac = (navigator.appVersion.indexOf("Mac") != -1);		//Any Mac browser
isDynamic = (DOM || NS4 || NS6 || (IE4 && !isMac) || (IE5 && isMac));
															//Any browsing supporting dHTML (Apparently... This may need work!)
canPrint = (window.print) ? 1 : 0;


// ##################
// Website-specific Elements
// ##################

// Pre-load images for mouseovers (global images only)
if (document.images)
	{
	//an_image_off = new Image();an_image_off.src = ''; //Put path to image in quotes
	//an_image_on = new Image();an_image_on.src = ''; //Put path to image in quotes
	}

// ##################
// Navigation
// ##################

// Helpful for using form pull-down fields for navigation
function goThere(frmName,fdName)
	{
	WhichOne = document[frmName].elements[fdName].options.selectedIndex
	URL = document[frmName].elements[fdName].options[WhichOne].value
	document[frmName].elements[fdName].options.selectedIndex = 0
	if (URL != "")
		{
		location.href = URL
		}
	}

// ##################
// Windows & Alerts
// ##################

// Popup any window
function wPopup(wPage,wWidth,wHeight,wID,wScrollbars,wLocation,wToolbar,wStatus,wResizable)
	{
	if (!wID) {wID = "Popup"}
	if (!wWidth) {wWidth = 500}
	if (!wHeight) {wHeight = 320}
	if (!wScrollbars) {wScrollbars = "yes"}
	if (!wLocation) {wLocation = "no"}
	if (!wToolbar) {wToolbar = "no"}
	if (!wStatus) {wStatus = "no"}
	//if (isLoaded == 0) { location.reload() }
	if (!wResizable) {wResizable = "yes"}
	popupWindow = window.open(wPage,wID,"width="+wWidth+",height="+wHeight+",scrollbars="+wScrollbars+",location="+wLocation+",toolbar="+wToolbar+",status="+wStatus+",resizable="+wResizable)
	if (window.focus) { popupWindow.focus() }
	}

// Useful for links from popup windows that should load in the opener
function wLink(URL)
	{
	top.opener.location.href = URL
	top.close()
	}

// ##################
// Image Manipulation
// ##################

// Swap any image to another
function imgSwap(id,name)
	{
	if (document.images)
		{
		document.images[id].src=eval(name+".src");
		}
	}

// Swap images with an optional fade effect
// - Requires fading style to be set.
// - Only works for IE5.5+ but falls back nicely
var transitionToggle = 0;
function imgSwapFX(id,name,transitionDisable)
	{
	if (transitionDisable || !document.images[id].filters || IE50)
		{
		if (document.images)
			{
			document.images[id].src=eval(name+".src");
			}
		}
	else
		{
		document.images[id].filters[0].Apply();
		// After setting Apply, changes to the object
		// are not displayed until Play is called.

		if (transitionToggle)
			{
			transitionToggle = 0;
			document.images[id].src=eval(name+".src");
			}
		else
			{
			transitionToggle = 1;
			document.images[id].src=eval(name+".src");
			}
		document.images[id].filters[0].Play();
		}
	}

// ##################
// Layer Manipulation
// ##################

// Turn any layer on and off
function layerToggle(togglelayer,state)
	{
	if (NS4)
		{
		if (document.layers[togglelayer])
			{
			document.layers[togglelayer].visibility = state
			}
		}
	else
		{
		if (document.all[togglelayer])
			{
			document.all[togglelayer].style.visibility = state
			}
		}
	}

// ##################
// Printing
// ##################

if (IE4 && !canPrint && !isMac) with (document)
	{
	writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
	writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
	writeln('Sub window_onunload');
	writeln('    On Error Resume Next');
	writeln('    Set WB = nothing');
	writeln('End Sub');
	writeln('Sub vbPrintPage');
	writeln('    OLECMDID_PRINT = 6');
	writeln('    OLECMDEXECOPT_DONTPROMPTUSER = 2');
	writeln('    OLECMDEXECOPT_PROMPTUSER = 1');
	writeln('    On Error Resume Next');
	writeln('    WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
	writeln('End Sub');
	writeln('<' + '/SCRIPT>');
	}

function printPage()
	{
	if (canPrint)
		{
		window.print()
		}
	else if (IE4 && !isMac)
		{
		vbPrintPage()
		}
	else
		{
		alert("Your web browser does not appear to support the automatic\nPrint function. To print this page, please select the \"Print\"\noption from the \"File\" menu of your web browser.")
		}
	}

// ##################
// Fun Stuff / Easter Eggs
// ##################

// No easter eggs currently present. :-)
