// ##################
// 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
// ##################

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
// ##################

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() }
	}

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.")
		}
	}

<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

<!-- //Begin function for antispam email address -->
var user;
var domain;
var suffix;

function data_email_address(user, domain, suffix){

document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + user + '@' + domain + '.' + suffix + '</a>');
}
//-->

// Start code for checking Contact Form
function checkContact() {
missinginfo = "";
if (document.form.txtName.value == "") {
missinginfo += "\n     -  Name";
}
if ((document.form.txtEmail.value == "") || 
(document.form.txtEmail.value.indexOf('@') == -1) || 
(document.form.txtEmail.value.indexOf('.') == -1)) {
missinginfo += "\n     -  Email address";
}
if(document.form.txtComments.value == "") {
missinginfo += "\n     -  Comments";
}

if (missinginfo != "") {
missinginfo = "You failed to correctly fill in your:\n" +
"_____________________________\n"+
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}

function OpenPopUp(url)
	{
	newWindow = window.open(url,'','resize=true,width=325,height=200,left=0,top=0,menubar=0,location=0,toolbar=0');
	}
	
function SendToFriend(url)
	{
	newWindow = window.open(url,'','resize=true,width=325,height=250,left=0,top=0,menubar=0,location=0,toolbar=0');
	}

<!-- //Function to open browser window to make a business nomination
function nominate_business() {
	msg=window.open("business_nomination.asp","","height=450,width=500,left=0,top=0");
	}
	//-->
	
<!-- //Function to open browser window to make an employee nomination
function nominate_employee() {
	msg=window.open("employee_nomination.asp","","height=450,width=500,left=0,top=0");
	}
	//-->

// ##################
// Fun Stuff / Easter Eggs
// ##################

// No easter eggs currently present. :-)
