//
var timeout = 300;
var closeTimer = 0;

//
function loadingBody(){
	
	var activeMenu = document.getElementById("active_menu").value;
	loadSubMenu();
	
	loadTopBanners(activeMenu);
	loadBottomBanners(activeMenu);
	
}

//
function loadSubMenu(activeMenu){

	var activeMenu = document.getElementById("active_menu").value;
	var menuId = "";
	
	if (activeMenu == "home") {
		loadHome();
		menuId = "home_menu";
		
	} else if (activeMenu == "corporate_profile") {
		loadCorporateProfile();
		menuId = "corp_profile_menu";
		
	} else if (activeMenu == "investor_info") {
		loadInvestorInfo();
		menuId = "investor_info_menu";
		
	} else if (activeMenu == "operational_profile") {
		loadOperationalProfile();
		menuId = "operational_profile_menu";
		
	} else if (activeMenu == "governence_sustainability") {
		loadGovernanceAndSustainability();	
		menuId = "gov_sus_menu";
		
	} else if (activeMenu == "media_centre") {
		loadMediaCentre();
		menuId = "media_center_menu";
		
	} else if (activeMenu == "careers") {
		loadCareers();
		menuId = "careers_menu";
	} 
	
	setActiveMenuBorders(menuId);
}


//
function loadTopBanners(activeMenu){

	var banner = "";
	
	if (activeMenu == "home") {
		
		banner = "<table id=\"top_banner\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
			banner += "<tr>";
				banner += "<td><a href=\"http://www.nfoods.co.za\" target=\"_blank\" onMouseOver=\"document.nfoods.src='images/banner/nfoods_c.png'\" onMouseOut=\"document.nfoods.src='images/banner/nfoods_bw.png'\"><img src=\"images/banner/nfoods_bw.png\" name=\"nfoods\" alt=\"Nutritional Foods Logo\" /></a></td>"	
				banner += "<td><a href=\"http://www.impilomarketing.co.za\" target=\"_blank\" onMouseOver=\"document.impilo.src='images/banner/impilo_c.png'\" onMouseOut=\"document.impilo.src='images/banner/impilo_bw.png'\"><img src=\"images/banner/impilo_bw.png\" name=\"impilo\" alt=\"Impilo Logo\" /></a></td>"
				banner += "<td><a href=\"http://www.e2e.za.com/?page_id=103\" target=\"_blank\" onMouseOver=\"document.imuniti.src='images/banner/imuniti_c.png'\" onMouseOut=\"document.imuniti.src='images/banner/imuniti_bw.png'\"><img src=\"images/banner/imuniti_bw.png\" name=\"imuniti\" alt=\"Imuniti Logo\" /></a></td>";
				banner += "<td><a href=\"#\" onMouseOver=\"document.funa.src='images/banner/funa_c.png'\" onMouseOut=\"document.funa.src='images/banner/funa_bw.png'\"><img src=\"images/banner/funa_bw.png\" name=\"funa\" alt=\"Funa Logo\" /></a></td>";
				banner += "<td><a href=\"#\" onMouseOver=\"document.sungold.src='images/banner/sungold_c.png'\" onMouseOut=\"document.sungold.src='images/banner/sungold_bw.png'\"><img src=\"images/banner/sungold_bw.png\" name=\"sungold\" alt=\"Sungold Logo\" /></a></td>";
			banner += "</tr>";
		banner += "</table>";
             
	} else {
		
		banner = "<table id=\"top_banner\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
			banner += "<tr>";
				banner += "<td><a href=\"http://www.nfoods.co.za\" target=\"_blank\" onMouseOver=\"document.nfoods.src='../images/banner/nfoods_c.png'\" onMouseOut=\"document.nfoods.src='../images/banner/nfoods_bw.png'\"><img src=\"../images/banner/nfoods_bw.png\" name=\"nfoods\" alt=\"Nutritional Foods Logo\" /></a></td>"	
				banner += "<td><a href=\"http://www.impilomarketing.co.za\" target=\"_blank\" onMouseOver=\"document.impilo.src='../images/banner/impilo_c.png'\" onMouseOut=\"document.impilo.src='../images/banner/impilo_bw.png'\"><img src=\"../images/banner/impilo_bw.png\" name=\"impilo\" alt=\"Impilo Logo\" /></a></td>"
				banner += "<td><a href=\"http://www.e2e.za.com/?page_id=103\" target=\"_blank\" onMouseOver=\"document.imuniti.src='../images/banner/imuniti_c.png'\" onMouseOut=\"document.imuniti.src='../images/banner/imuniti_bw.png'\"><img src=\"../images/banner/imuniti_bw.png\" name=\"imuniti\" alt=\"Imuniti Logo\" /></a></td>";
				banner += "<td><a href=\"#\" onMouseOver=\"document.funa.src='../images/banner/funa_c.png'\" onMouseOut=\"document.funa.src='../images/banner/funa_bw.png'\"><img src=\"../images/banner/funa_bw.png\" name=\"funa\" alt=\"Funa Logo\" /></a></td>";
				banner += "<td><a href=\"#\" onMouseOver=\"document.sungold.src='../images/banner/sungold_c.png'\" onMouseOut=\"document.sungold.src='../images/banner/sungold_bw.png'\"><img src=\"../images/banner/sungold_bw.png\" name=\"sungold\" alt=\"Sungold Logo\" /></a></td>";
			banner += "</tr>";
		banner += "</table>";
	}
	
	document.getElementById("top_banner_td").innerHTML = banner	
	
}

//
function loadBottomBanners(activeMenu){
	
	var banner = "";
		
	banner += "<table id=\"bottom_banner\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
		banner += "<tr>";
			banner += "<td class=\"mission\" width=\"30%\"><u>Mission</u><br /><br />Nutritional Holdings' mission is to be the preferred regional wellness and healthcare product and service supplier to the lower and middle-income segments of the market, and to produce sustainable returns for shareholders.</td>";
		
			banner += "<td>&nbsp;&nbsp;</td>";
		
			banner += "<td width=\"40%\">";
				banner += "<table class=\"contact\" width=\"100%\">";
					banner += "<tr><td colspan=\"2\" style=\"font-size:14px;\"><b><u>Contact</u></b></td></tr>";
					banner += "<tr>";
						
                        banner += "<td width=\"50%\"><b>Kwa-Zulu Natal:</b><br />Frosterley Park,<br />9 Frosterley Cresent,<br />1st Floor,<br />La Lucia Ridge Office Estate,<br />4019<br /><b>Tel:</b> +27 31 584 7100<br /><b>Fax:</b> +27 31 584 7101</td><tr>";
					banner += "</tr>";
					banner += "<tr><td colspan=\"2\"><a href=\"mailto:info@nholdings.co.za\">info@nholdings.co.za</a></td></tr>";
				banner += "</table>";			
			banner += "</td>";
			
			banner += "<td>&nbsp;&nbsp;</td>";
			
			banner += "<td class=\"vision\" width=\"30%\"><u>Vision</u><br /><br />Nutritional Holdings' vision is to develop and provide affordable, sustainable wellness products, services and programmes and to actively promote socio-economic wellbeing for South Africans and throughout sub-Saharan Africa.</td>";
		
		banner += "</tr>";
		
	banner += "</table>";
		
	document.getElementById("bottom_banner_td").innerHTML = banner	
}

//
function setActiveMenuBorders(menuId){
	document.getElementById(menuId).style.borderTop = "solid white 2px";
	document.getElementById(menuId).style.borderBottom = "solid white 2px";
}

//
function closeMenu(){
	closeTimer = window.setTimeout(loadSubMenu, timeout);	
}

//
function cancelTimout(){
	
	if(closeTimer)
	{
		window.clearTimeout(closeTimer);
		closeTimer = null;
	}
}


//
function loadHome(){
	
	var activeMenu = document.getElementById("active_menu").value;
	var subMenu;
	
	if (activeMenu == "home") {
		subMenu = "<a href=\"related_links.html\">Related Links</a> | <a href=\"site_map.html\">Site Map</a>";
	} else {
		subMenu = "<a href=\"../related_links.html\">Related Links</a> | <a href=\"../site_map.html\">Site Map</a>";
	}
	
	document.getElementById("subMenu").innerHTML = subMenu;
	cancelTimout();	
}

//
function loadCorporateProfile(){
	
	var activeMenu = document.getElementById("active_menu").value;
	var subMenu;
	
	if (activeMenu == "corporate_profile") {
		subMenu = "<a href=\"overview.html\">Overview</a> | <a href=\"strategy.html\">Stategy</a> | <a href=\"company_structure.html\">Company Structure</a> | <a href=\"directors.html\">Board of Directors</a> | <a href=\"exec_management.html\">Executive Management</a> | <a href=\"operational_presence.html\">Operational Presence</a> | <a href=\"history.html\">History</a> | <a href=\"bbbee.html\">BBBEE</a> | <a href=\"ConditionsofPurchase21102011.pdf\"target='_blank'>Trading Conditions </a>";	
	} else if (activeMenu == "home") {
		subMenu = "<a href=\"corporate_profile/overview.html\">Overview</a> | <a href=\"corporate_profile/strategy.html\">Stategy</a> | <a href=\"corporate_profile/company_structure.html\">Company Structure</a> | <a href=\"corporate_profile/directors.html\">Board of Directors</a> | <a href=\"corporate_profile/exec_management.html\">Executive Management</a> | <a href=\"corporate_profile/operational_presence.html\">Operational Presence</a> | <a href=\"corporate_profile/history.html\">History</a> | <a href=\"corporate_profile/bbbee.html\">BBBEE</a> | <a href=\"corporate_profile/ConditionsofPurchase21102011.pdf\" target='_blank'>Trading Conditions</a>";	
	}  else {
		subMenu = "<a href=\"../corporate_profile/overview.html\">Overview</a> | <a href=\"../corporate_profile/strategy.html#\">Stategy</a> | <a href=\"../corporate_profile/company_structure.html\">Company Structure</a> | <a href=\"../corporate_profile/directors.html\">Board of Directors</a> | <a href=\"../corporate_profile/exec_management.html\">Executive Management</a> | <a href=\"../corporate_profile/operational_presence.html\">Operational Presence</a> | <a href=\"../corporate_profile/history.html\">History</a> | <a href=\"../corporate_profile/bbbee.html\">BBBEE</a> | <a href=\"corporate_profile/ConditionsofPurchase21102011.pdf\" target='_blank'>Trading Conditions</a>";	
	}
	
	document.getElementById("subMenu").innerHTML = subMenu;
	cancelTimout();
}

//
function loadInvestorInfo(){
	
	var activeMenu = document.getElementById("active_menu").value;
	var subMenu;
	
	if (activeMenu == "investor_info") {
		subMenu = "<a href=\"financial_performace.html\">Financial Performance</a> | <a href=\"financial_results.html\">Financial Results</a> | <a href=\"share_trade_stats.html\">Share Trading Statistics</a> | <a href=\"shareholder_info.html\">Shareholder Information</a> | <a href=\"admin_info.html\">Administrative Information</a> | <a href=\"stakeholder_comm.html\">Stakeholder Communication</a> |<br /><a href=\"sens.html\">SENS</a> | <a href=\"investor_calendar.html\">Investor Calendar</a> | <a href=\"investor_relations_contact.html\">Investor Relations Contact</a>";
	} else if (activeMenu == "home") {
		subMenu = "<a href=\"investor_info/financial_performace.html\">Financial Performance</a> | <a href=\"investor_info/financial_results.html\">Financial Results</a> | <a href=\"investor_info/share_trade_stats.html\">Share Trading Statistics</a> | <a href=\"investor_info/shareholder_info.html\">Shareholder Information</a> | <a href=\"investor_info/admin_info.html\">Administrative Information</a> | <a href=\"investor_info/stakeholder_comm.html\">Stakeholder Communication</a> |<br /><a href=\"investor_info/sens.html\">SENS</a> | <a href=\"investor_info/investor_calendar.html\">Investor Calendar</a> | <a href=\"investor_info/investor_relations_contact.html\">Investor Relations Contact</a>";
	} else {
		subMenu = "<a href=\"../investor_info/financial_performace.html\">Financial Performance</a> | <a href=\"../investor_info/financial_results.html\">Financial Results</a> | <a href=\"../investor_info/share_trade_stats.html\">Share Trading Statistics</a> | <a href=\"../investor_info/shareholder_info.html\">Shareholder Information</a> | <a href=\"../investor_info/admin_info.html\">Administrative Information</a> | <a href=\"../investor_info/stakeholder_comm.html\">Stakeholder Communication</a> |<br /><a href=\"../investor_info/sens.html\">SENS</a> | <a href=\"../investor_info/investor_calendar.html\">Investor Calendar</a> | <a href=\"../investor_info/investor_relations_contact.html\">Investor Relations Contact</a>";
	}
	
	document.getElementById("subMenu").innerHTML = subMenu;
	cancelTimout();
}

//
function loadOperationalProfile(){
	
	var activeMenu = document.getElementById("active_menu").value;
	var subMenu;
	
	if (activeMenu == "operational_profile") {
		subMenu = "<a href=\"services.html\">Divisions, Products and Services</a> | <a href=\"research_development.html\">Research and Development</a> | <a href=\"nutritional_foods.html\">Nutritional Foods</a> | <a href=\"impilo.html\">Impilo</a> | <a href=\"imuniti_pack_iscp.html\">Imuniti Pack</a>";
	} else if (activeMenu == "home") {
		subMenu = "<a href=\"operational_profile/services.html\">Divisions, Products and Services</a> | <a href=\"operational_profile/research_development.html\">Research and Development</a> | <a href=\"operational_profile/nutritional_foods.html\">Nutritional Foods</a> | <a href=\"operational_profile/impilo.html\">Impilo</a> | <a href=\"operational_profile/imuniti_pack_iscp.html\">Imuniti Pack</a>";
	} else {
		subMenu = "<a href=\"../operational_profile/services.html\">Divisions, Products and Services</a> | <a href=\"../operational_profile/research_development.html\">Research and Development</a> | <a href=\"../operational_profile/nutritional_foods.html\">Nutritional Foods</a> | <a href=\"../operational_profile/impilo.html\">Impilo</a> | <a href=\"../operational_profile/imuniti_pack_iscp.html\">Imuniti Pack</a>";
	}
	
	document.getElementById("subMenu").innerHTML = subMenu;
	cancelTimout();
}

//
function loadGovernanceAndSustainability(){
	
	var activeMenu = document.getElementById("active_menu").value;
	var subMenu;
	
	if (activeMenu == "governence_sustainability") {
		subMenu = "<a href=\"sustainability.html\">Sustainability</a> | <a href=\"commitment.html\">Commitment</a>";
	} else if (activeMenu == "home") {
		subMenu = "<a href=\"governence_sustainability/sustainability.html\">Sustainability</a> | <a href=\"governence_sustainability/commitment.html\">Commitment</a>";
	} else {
		subMenu = "<a href=\"../governence_sustainability/sustainability.html\">Sustainability</a> | <a href=\"../governence_sustainability/commitment.html\">Commitment</a>";
	}
	
	document.getElementById("subMenu").innerHTML = subMenu;
	cancelTimout();
}

//
function loadMediaCentre(){
	
	var activeMenu = document.getElementById("active_menu").value;
	var subMenu;
	
	if (activeMenu == "media_centre") {
		subMenu = "<a href=\"press_releases.html\">Press Releases</a> | <a href=\"media_contact.html\">Media Contact</a>";
	} else if (activeMenu == "home") {
		subMenu = "<a href=\"media_centre/press_releases.html\">Press Releases</a> | <a href=\"media_centre/media_contact.html\">Media Contact</a>";
	} else {
		subMenu = "<a href=\"../media_centre/press_releases.html\">Press Releases</a> | <a href=\"../media_centre/media_contact.html\">Media Contact</a>";
	}
	
	document.getElementById("subMenu").innerHTML = subMenu;
	cancelTimout();
}

//
function loadCareers(){
	
	var activeMenu = document.getElementById("active_menu").value;
	var subMenu;
	
	if (activeMenu == "careers") {
		subMenu = "<a href=\"positions.html\">Positions Available</a>";
	} else if (activeMenu == "home") {
		subMenu = "<a href=\"careers/positions.html\">Positions Available</a>";
	} else {
		subMenu = "<a href=\"../careers/positions.html\">Positions Available</a>";
	}
	
	document.getElementById("subMenu").innerHTML = subMenu;
	cancelTimout();
}
















