var g_SubMenuList = new Array();
var g_MenuCount = 0;
var g_LastSelection = "none";
var g_LastSelectionSection = "normal";

function AddSubMenu(a_SubMenu)	{
	g_SubMenuList[g_MenuCount] = a_SubMenu;
	g_MenuCount++;
}

function CloseAllSubMenus(a_SubMenuBeingOpened)	{
	
	for(var i=0; i < g_MenuCount; i++)	{
		var l_SubSection = document.getElementById(g_SubMenuList[i]);
		var l_Section = document.getElementById(g_LastSelection);
		
		if(a_SubMenuBeingOpened != g_SubMenuList[i])	{
			if(g_LastSelection != 'none')	{
				l_Section.className = GetNormal(g_LastSelectionSection);
			}
			
			l_SubSection.style.display = 'none';
			
		}
	}
}

function ExpandMenuSection(SubMenu, obj, a_Section)	{
	CloseAllSubMenus(SubMenu);
	
	var l_SubSection = document.getElementById(SubMenu);
	var l_Section = document.getElementById(obj);
	g_LastSelection = obj;
	g_LastSelectionSection = a_Section;
	
	if(l_SubSection.style.display == 'none')	{
		l_Section.className = GetHover(a_Section);
		l_SubSection.style.display = '';
	}
	
	
	return false;
}

function GetHover(a_Section)	{
	var l_ReturnVal = "";
	
	switch(a_Section)	{
		case "Adult learners":
			l_ReturnVal = "MenuTopLevelItemAdultSelected";
			break;
		case "School leavers":
			l_ReturnVal = "MenuTopLevelItemStudentSelected";
			break;
		case "Employers":
			l_ReturnVal = "MenuTopLevelItemEmployerSelected";
			break;
		case "Corporate &amp; community":
			l_ReturnVal = "MenuTopLevelItemCorporateSelected";
			break;
		case "Apprenticeships":
			l_ReturnVal = "MenuTopLevelItemApprenticeSelected";
			break;
		case "Higher education":
			l_ReturnVal = "MenuTopLevelItemHigherEdSelected";
			break;
		default:
			l_ReturnVal = "MenuTopLevelItemSelected";
			break;
	}
	
	return l_ReturnVal;
}

function GetNormal(a_Section)	{
	var l_ReturnVal = "";
	
	switch(a_Section)	{
		case "Adult learners":
			l_ReturnVal = "MenuTopLevelItemAdult";
			break;
		case "School leavers":
			l_ReturnVal = "MenuTopLevelItemStudent";
			break;
		case "Employers":
			l_ReturnVal = "MenuTopLevelItemEmployer";
			break;
		case "Corporate &amp; community":
			l_ReturnVal = "MenuTopLevelItemCorporate";
			break;
		case "Apprenticeships":
			l_ReturnVal = "MenuTopLevelItemApprentice";
			break;
		case "Higher education":
			l_ReturnVal = "MenuTopLevelItemHigherEd";
			break;
		default:
			l_ReturnVal = "MenuTopLevelItem";
			break;
	}
	
	return l_ReturnVal;
}

function PopulateSearch(a_Keyword)	{
	var keywords = document.getElementById('keywords');
	keywords.value = a_Keyword;
}

function SetChecks(a_Value, a_Count)	{
	for(var i=0; i < a_Count; i++)	{
		var l_CheckBox = document.getElementById("prosp" + i);
		l_CheckBox.checked = a_Value;
	}
}

function UnCheckFullPros()	{
	var l_CheckBox = document.getElementById("FullProsp");
	l_CheckBox.checked = false;
}

function EnableAndDisable(a_OnElement, a_OffElement)
{
	var On = document.getElementById(a_OnElement);
	var Off = document.getElementById(a_OffElement);
	On.style.display = "";
	Off.style.display = "none";
}
