﻿<!-- Hide

var TheMenuMainTimeout = 400;
var TheMenuMainLevel1Active = null;
var TheMenuMainLevel2Active = null;
var TheTimeOutLevel1OverArray = new Array();
var TheTimeOutLevel1OutArray = new Array()

function OnMenuStart()
	{
	TheTimeOutLevel1OverArray["Home"] = null;
	TheTimeOutLevel1OverArray["AboutUs"] = null;
	TheTimeOutLevel1OverArray["Capabilities"] = null;
	TheTimeOutLevel1OverArray["Sectors"] = null;
	TheTimeOutLevel1OverArray["OurApproach"] = null;
	TheTimeOutLevel1OverArray["Downloads"] = null;
	TheTimeOutLevel1OverArray["Careers"] = null;
	TheTimeOutLevel1OverArray["ContactUs"] = null;
	TheTimeOutLevel1OutArray["Home"] = null;
	TheTimeOutLevel1OutArray["AboutUs"] = null;
	TheTimeOutLevel1OutArray["Capabilities"] = null;
	TheTimeOutLevel1OutArray["Sectors"] = null;
	TheTimeOutLevel1OutArray["OurApproach"] = null;
	TheTimeOutLevel1OutArray["Downloads"] = null;
	TheTimeOutLevel1OutArray["Careers"] = null;
	TheTimeOutLevel1OutArray["ContactUs"] = null;
	TheMenuMainLevel1Active = document.FormDefault.FormFieldMainMenuLevel1.value;
	OnDebug("OnMenuStart TheMenuMainLevel1Active=" + TheMenuMainLevel1Active);
	}

function OnDebug(TheMessage)
	{
	var TheDebug;
	var TheTime = new Date();
	TheDebug = document.getElementById("Debug");
	TheDebug.innerHTML = TheTime.getHours() + ":" + TheTime.getMinutes() + ":" + TheTime.getSeconds() + "." + TheTime.getMilliseconds() + ": " + TheMessage + "<br>" + TheDebug.innerHTML;
	}

function OnMenuMainLevel1OverDelay(TheMenuId)
	{
	OnDebug("OnMenuMainLevel1OverDelay TheMenuId=" + TheMenuId);
	//if (TheTimeOutLevel1Over == null)
	if (TheTimeOutLevel1OutArray[TheMenuId] != null)
		{
		window.clearTimeout(TheTimeOutLevel1OutArray[TheMenuId]);
		TheTimeOutLevel1OutArray[TheMenuId] = null;
		OnDebug("OnMenuMainLevel1OverDelay Cancel TheTimeOutLevel1OutArray TheMenuId=" + TheMenuId );
		}
	if (TheTimeOutLevel1OverArray[TheMenuId] != null)
		{
		window.clearTimeout(TheTimeOutLevel1OverArray[TheMenuId]);
		TheTimeOutLevel1OverArray[TheMenuId] = null;
		OnDebug("OnMenuMainLevel1OverDelay Cancel TheTimeOutLevel1OverArray TheMenuId=" + TheMenuId );
		}
		TheTimeOutLevel1OverArray[TheMenuId] = window.setTimeout("OnMenuMainLevel1Over('" + TheMenuId + "')", TheMenuMainTimeout);
	//else
		{
		//window.clearTimeout(TheTimeOutLevel1Over);
		}
	}

function OnMenuMainLevel1Over(TheMenuId)
	{
	var TheMenuMainLevelName;
	OnDebug("OnMenuMainLevel1Over Show TheMenuId=" + TheMenuId + "; TheMenuMainLevel1Active=" + TheMenuMainLevel1Active);
	TheTimeOutLevel1OverArray[TheMenuId] = null;
	if (TheTimeOutLevel1OutArray[TheMenuId] != null)
		{
		window.clearTimeout(TheTimeOutLevel1OutArray[TheMenuId]);
		TheTimeOutLevel1OutArray[TheMenuId] = null;
		OnDebug("OnMenuMainLevel1Over Cancel TheTimeOutLevel1OutArray TheMenuId=" + TheMenuId );
		}
	var TheElement;

	// Hide the active menu
	if (TheMenuId != TheMenuMainLevel1Active)
		{
		// Hide the old level 2
		TheMenuMainLevelName = GetMenuItemLevel2Id(TheMenuMainLevel1Active);
		OnDebug("OnMenuMainLevel1Over Hide Level 2 TheMenuMainLevelName=" + TheMenuMainLevelName);
		OnElementHide(TheMenuMainLevelName);

		// Hide the old level 1
		TheMenuMainLevelName = GetMenuItemLevel1Id(TheMenuMainLevel1Active);
		OnDebug("OnMenuMainLevel1Out Hide TheMenuMainLevelName=" + TheMenuMainLevelName);
		TheElement = document.getElementsByName(TheMenuMainLevelName);
		TheElement = TheElement[0];
		TheElement.className = TheElement.className.replace(" MenuMainLevel1Active", "");
		OnDebug("OnMenuMainLevel1Over Hide TheElement=" + TheElement.className);
		}

	// Show the new level 1
	TheMenuMainLevelName = GetMenuItemLevel1Id(TheMenuId);
	OnDebug("OnMenuMainLevel1Over Show TheMenuMainLevelName=" + TheMenuMainLevelName);
	TheElement = document.getElementsByName(TheMenuMainLevelName);
	TheElement = TheElement[0];
	if (TheElement.className.indexOf(" MenuMainLevel1Active") < 0)
		TheElement.className += " MenuMainLevel1Active";

	// Show the new level 2
	TheMenuMainLevelName = GetMenuItemLevel2Id(TheMenuId);
	OnDebug("OnMenuMainLevel1Over Show Level 2 TheMenuMainLevelName=" + TheMenuMainLevelName);
	OnElementShow(TheMenuMainLevelName);
	}

function OnMenuMainLevel1OutDelay(TheMenuId)
	{
	OnDebug("OnMenuMainLevel1OutDelay TheMenuId=" + TheMenuId);
	//if (TheTimeOutLevel1OutArray[TheMenuId] == null)
	if (TheTimeOutLevel1OutArray[TheMenuId] != null)
		{
		window.clearTimeout(TheTimeOutLevel1OutArray[TheMenuId]);
		TheTimeOutLevel1OutArray[TheMenuId] = null;
		OnDebug("OnMenuMainLevel1OutDelay Cancel TheTimeOutLevel1OutArray TheMenuId=" + TheMenuId );
		}
	if (TheTimeOutLevel1OverArray[TheMenuId] != null)
		{
		window.clearTimeout(TheTimeOutLevel1OverArray[TheMenuId]);
		TheTimeOutLevel1OverArray[TheMenuId] = null;
		OnDebug("OnMenuMainLevel1OutDelay Cancel TheTimeOutLevel1OverArray TheMenuId=" + TheMenuId );
		}
	TheTimeOutLevel1OutArray[TheMenuId] = window.setTimeout("OnMenuMainLevel1Out('" + TheMenuId + "')", TheMenuMainTimeout);
	}

function OnMenuMainLevel1Out_x(TheMenuId)
	{
	OnDebug("OnMenuMainLevel1Out Show TheMenuId=" + TheMenuId + "; TheMenuMainLevel1Active=" + TheMenuMainLevel1Active);
	}

function OnMenuMainLevel1Out(TheMenuId)
	{
	var TheMenuMainLevelName;
	TheTimeOutLevel1OutArray[TheMenuId] = null;
	OnDebug("OnMenuMainLevel1Out 1 Show TheMenuId=" + TheMenuId + "; TheMenuMainLevel1Active=" + TheMenuMainLevel1Active);

	// Show the active level 2 if one
	if (TheMenuMainLevel1Active != null)
		{
		// Hide the current level 2
		if (TheMenuId != TheMenuMainLevel1Active)
			{
			// Hide the old level 2
			TheMenuMainLevelName = GetMenuItemLevel2Id(TheMenuId);
			//OnDebug("OnMenuMainLevel1Out Hide Level 2 TheMenuMainLevelName=" + TheMenuMainLevelName);
			OnElementHide(TheMenuMainLevelName);

			// Hide the old level 1
			TheMenuMainLevelName = GetMenuItemLevel1Id(TheMenuId);
			OnDebug("OnMenuMainLevel1Out Hide TheMenuMainLevelName=" + TheMenuMainLevelName);
			TheElement = document.getElementsByName(TheMenuMainLevelName);
			TheElement = TheElement[0];
			TheElement.className = TheElement.className.replace(" MenuMainLevel1Active", "");
			OnDebug("OnMenuMainLevel1Out Hide TheElement=" + TheElement.className);
			}

		// Show the new level 2
		TheMenuMainLevelName = GetMenuItemLevel2Id(TheMenuMainLevel1Active);
		OnDebug("OnMenuMainLevel1Out Show TheMenuMainLevelName=" + TheMenuMainLevelName);
		OnElementShow(TheMenuMainLevelName);

		// Show the new level 1
		TheMenuMainLevelName = GetMenuItemLevel1Id(TheMenuMainLevel1Active);
		OnDebug("OnMenuMainLevel1Over Show TheMenuMainLevelName=" + TheMenuMainLevelName);
		TheElement = document.getElementsByName(TheMenuMainLevelName);
		TheElement = TheElement[0];
		if (TheElement.className.indexOf(" MenuMainLevel1Active") < 0)
			TheElement.className += " MenuMainLevel1Active";
		}
	}

function GetMenuItemLevel1Id(TheMenuLevel1)
	{
	return("MenuMainLevel1_" + TheMenuLevel1);
	}

function GetMenuItemLevel2Id(TheMenuLevel1)
	{
	return("MenuMainLevel2_" + TheMenuLevel1);
	}

// End hide -->
