﻿/* 
-------------------------------------------------------------------
Configure display of main and sub navigation
-------------------------------------------------------------------
*/
try
{
	
	// If the home page is not displaying, ID of main nav div is "top_nav_2," rather than "top_nav"
	if (!IsHomePage)
	{ExtraIDText = "_2"}
	else
	{ExtraIDText = ""}
			
	// Find the array of links in the main nav
	MainLinks = document.getElementById("top_nav" + ExtraIDText).getElementsByTagName("a")

	// Loop through main nav array
	for (i=0; i<MainLinks.length; i++) 
	{
			
		// Get a reference to the current link
		CurrentLink = MainLinks[i]
				
		// If the home page is not displaying
		if (!IsHomePage)
		{
		
			// If current link is the selected link, set the class and exit loop
			if (CurrentLink.id == SelectedMainLink)
			{
				CurrentLink.className = "on"
				break
			}
		}
		
		// If the home page is displaying
		else
		{
		
			// If the current link is one of the first 2 links, set the class
			if (i < 2)
			{
				
				CurrentLink.className = "white"
				
				if (i == 1)
				{break}
				
			}
						
		}
					
	}
	
	// If the home page is not displaying
	if (!IsHomePage)
	{
	
		// Get references to left sidebar and sub navigation space
		LeftSidebar = document.getElementById("left_sidebar")
		SubNav = document.getElementById("sub_nav")
			
		// If there is no sub navigation, change the style of the left sidebar so no background image appears		
		if (SubNav.getElementsByTagName("a").length == 0)
		{
			LeftSidebar.style.backgroundImage = "url(/images/transparent.gif)"
		}
						
	}
					
}

catch(e)
{}




/* 
-------------------------------------------------------------------
Switch to 2 column layout
-------------------------------------------------------------------
*/
function TwoColumn()
{

	if (!IsHomePage)
	{
		document.getElementById("full_column").style.width = "640px"
		document.getElementById("right_sidebar").style.display = "none"
	}

}



/* 
-------------------------------------------------------------------
Submit main form
-------------------------------------------------------------------
*/

function SubmitMasterForm(FormAction,FormTarget)

{

	// Get reference to main form
	f = document.forms[0]

	// Set action of form
	if (FormAction != "" && FormAction != null)
	{f.action = FormAction}

	// Set target of form if necessary
	if (FormTarget != "" && FormTarget != null)
	{f.target = FormTarget}

	f.submit()

}