/**************************************************************************\
	File Name:			global.js
	Directory:			/global/js/
	Date Start:			20041130
	Date Last:			20041202
/**************************************************************************/

// Function: Global Onloader
function oL()
{
	// Focus First Input Of Form If Form Exists And Is Text Field
	if (document.forms[0] && document.forms[0].elements[0] && document.forms[0].elements[0].type == 'text')
		document.forms[0].elements[0].focus();
}

// Function: Change Images
function cI(imgName,imgLink)
{
	// Switch Image With Rollover Argument Image Link
	if (document.images)
		document[cI.arguments[0]].src = cI.arguments[1];
}

// Function: PopUp Window
function pW(url,wN,w,h)
{
	// Pop Window In Horiz. Center 100px Down
	if (self.screenTop && self.screen.width)
	{
		l = ((self.screen.width/2)-1/2*w);
		t = (self.screenTop+100);
	}
	// Pop Window In Horiz. Center And Vert. Center
	else if (screen.width)
	{
		l = ((self.screen.width/2)-((1/2)*w));
		t = ((self.screen.height/3)-((1/2)*h));
	}
	// Default To Upper Left Corner
	else
	{
		l = 0;
		t = 0;
	}
	// Pop Window With Arguments In Placement
	winOpen = window.open(url,'wN','width='+w+',height='+h+',left='+l+',top='+t+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
}

// Function: Show Hidden Div/Layer
function sD(whichId) 
{
	// Close Currently Displayed Div If Necessary
	if (leftNav_SwitchId != '' && leftNav_SwitchId != whichId)
		document.getElementById(leftNav_SwitchId).style.display = 'none';
	
	// Switch Div Display Depending On Current State
	if (document.getElementById(whichId).style.display == 'none')
	{
		// Display Div
		document.getElementById(whichId).style.display = 'block';
		
		// Set Global JS Var Div Id To Selected Div Id
		leftNav_SwitchId = whichId;
	}
	else
	{
		// Hide Div
		document.getElementById(whichId).style.display = 'none';
		
		// Set Global JS Var Div Id To NULL
		leftNav_SwitchId = '';
	}
}
// Set Div Id For Switch On Start - Closes Current Displayed If New Is Displayed (function = sD)
//var leftNav_SwitchId = '';

// Function: Redirector
function redirect(url)
{
	window.location.href = url;
}

// Function: Redirect User From PopUp To Parent Page
function redirectToParent(url)
{
	window.opener.location.href = url;
	window.close();
}

// Function: Automatic Form Run On Select Choice
function sCP(whichPage)
{
	newPage = whichPage.options[whichPage.selectedIndex].value;	
	if (newPage != "")
		document.location.href = newPage;
}
