// ****************************************
// * FUNCTIONS SHARED ACROSS THE WEBSITE	*
// ****************************************

/* MENU HANDLING */
function startlist()
	{
	// This simulates a pseudo-class hover function for
	// li objects under IE
	if (document.all&&document.getElementById)
		{
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++)
			{
			node = navRoot.childNodes[i];

			// Fake hover pseudo-class by using onmouseover
			// functionality.
			if (node.nodeName=="LI")
				{
				node.onmouseover=function()
					{
					this.className+=" over";
					}
				node.onmouseout=function()
					{
					this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}

function showSub(aSubMenuID)
	{
	// Show the appropriate submenu for a parent item
	var subA = 'sub' + aSubMenuID;
	var subB;

	// Clear submenus
	for (i=0; i < 3; i++)
		{
		subB = 'sub' + i;
		document.getElementById(subB).className = 'sub_menu_hide';
		}

	// Display submenu unless last item
	if (aSubMenuID < 3)
		{
		document.getElementById(subA).className = 'sub_menu';
		}

	// Show first child page
	showFirstChild(aSubMenuID);
	}

function showFirstChild(aSubMenuID)
	{
	// Shows the first page on the submenu list when
	// parent item is selected.
	switch(aSubMenuID)
		{
		// Contact
		case 0:	{
						loadPage("../contact/con_inf.aspx");
						} break;

		// Expertise
		case 1:	{
						loadPage("../expertise/exp_app.aspx");
						} break;

		// Services
		case 2:	{
						loadPage("../services/svc_itm.aspx");
						} break;

		// Company
		case 3:	{
						loadPage("../company/cmp_ove.aspx");
						} break;
		}
	}

/* PAGE LOADING FUNCTIONS */
function refreshPage()
	{
	// Reloads the page. Typically used with onResize and
	// onAfterPrint events to update scrolling div layout
	location.reload();
	}

function setupPrintPreview(aCurrentDivID,aPrintPreviewClass)
	{
	// Changes a fixed height, scrolling div to a full
	// height div to prevent issues with text cutoff
	document.getElementById('copyAreaDiv').className 	= 'copy_print';
	document.getElementById('wrapperDiv').className		= 'wrapper_print';
	document.getElementById('areaDiv').className			= 'area_print';
	}

function returnHome()
	{
	// Loads the homepage
	document.location.href = "/index.aspx";
	}

function loadPage(aPageLocStr)
	{
	// Loads the page associated with the location string;
	document.location.href = aPageLocStr;
	}

function loadPageInPopup(aPageLoc,aType,aWidth,aHeight)
	{
	// Opens a popup with a specified page, size, and type (modal, modeless)
	// aType acceptable values:aPageLoc,aType,aWidth,aHeight
	// 		0 = modal
	//		1 = modeless

	var popupVal;
	var sizeVal;
	var test = '';

	sizeVal = "dialogWidth:" + aWidth +"px;dialogHeight:" + aHeight + "px;edge:raised;center:yes;help:no;resizeable:no;status:no;scroll:no"

	popupVal = showModalDialog(aPageLoc,test,sizeVal);
  }

function updateStatusBar(someText)
	{
	// Write text to the browser window status bar
	window.status = someText;
	}
