
//---------------------------------------------------------------------------------------'
//toggle navigation selection
function Nav_Vis(iArrN_Current) {
	var iArrN = 0;
	var iSNav = 0;
	var blnChange = (new cookie('iArrN_Current').read() != iArrN_Current);
	
	//sub nav cookie value
	if (blnChange) {
		new cookie('iArrN_Current', iArrN_Current, 7, '/').set();
		new cookie('iArrSN_Current', -1, 7, '/').set();
	};
	
	//Refresh the menu to display the current sections
	fnc_NavRefresh()
	
	//Action the click on the menu section
	switch(arrNav[iArrN_Current][0]) {
		case 'NavSection':
			break;
		case 'EosSection':
			document.location.href = arrNav[iArrN_Current][1]
			break;
		case 'LinkSection':
			document.location.href = arrNav[iArrN_Current][1]
			break;
		default:
			break;
	};
}
//---------------------------------------------------------------------------------------'
//Refresh the menu display to show the correct menu sections
function fnc_NavRefresh() {
		
	var iArrN = 0;
	var iArrN_Current = new cookie('iArrN_Current').read();
	
	//Set all the menu sections to not clicked
	for (iArrN = 0; iArrN <= icArrN; iArrN++) {
		if (iArrN == iArrN_Current) {
			//Display the clicked on section
			switch(arrNav[iArrN][0]) {
				case 'NavSection':
					fnc_FormElm("nav_ctrl_" + iArrN).className = "open_nav";
					fnc_FormElm("nav_img_" + iArrN).src = "../../img/generic/warrow_up.gif";
					fnc_FormElm("nav_imgr_" + iArrN).className = "open_nav";
					fnc_FormElm("nav_div_" + iArrN).style.display = "block";
					fnc_SNavRefresh();
					break;
				case 'EosSection':
					fnc_FormElm("nav_ctrl_" + iArrN).className = "open_nav_eos";
					fnc_FormElm("nav_div_" + iArrN).style.display = "block";
					break;
				case 'LinkSection':
					fnc_FormElm("nav_ctrl_" + iArrN).className = "open_nav_eos";
					break;
				default:
					break;
			};
		} else {
			//Hide the non-clicked on menu sections
			switch(arrNav[iArrN][0]) {
				case 'NavSection':
					fnc_FormElm("nav_ctrl_" + iArrN).className = "closed_nav";
					fnc_FormElm("nav_img_" + iArrN).src = "../../img/generic/warrow_down.gif";
					fnc_FormElm("nav_imgr_" + iArrN).className = "closed_nav";
					fnc_FormElm("nav_div_" + iArrN).style.display = "none";
					break;
				case 'EosSection':
					fnc_FormElm("nav_ctrl_" + iArrN).className = "closed_nav_eos";
					fnc_FormElm("nav_img_" + iArrN).src = "../../img/generic/warrow_right.gif";
					fnc_FormElm("nav_div_" + iArrN).style.display = "none";					
					break;
				case 'LinkSection':
					fnc_FormElm("nav_ctrl_" + iArrN).className = "closed_nav_eos";
					break;
				default:
					break;
			};
		};		
	};
}
//---------------------------------------------------------------------------------------'
//Refresh the menu display to show the correct menu sections
function fnc_SNavRefresh() {
	var iArrSN = 0;
	var iArrN_Current = new cookie('iArrN_Current').read();
	var icArrSN = arrNav[iArrN_Current][1];
	var iArrSN_Current = new cookie('iArrSN_Current').read();
	
	//Loop through the sub-sections
	for (iArrSN = 0; iArrSN <= icArrSN; iArrSN++) {
		if (iArrSN == iArrSN_Current) {
			//Highlight the clicked on sub-section
			fnc_FormElm("snav_" + iArrN_Current + "_" + iArrSN_Current).className = "high_snav";
		} else {
			//Unhighlight the remaining sub-sections
			fnc_FormElm("snav_" + iArrN_Current + "_" + iArrSN).className = "empty_snav";
		};		
	};
}
//---------------------------------------------------------------------------------------'
//Navigation jumping
function NavLink(str_SURL, iArrSN) {

	//expose selected sub headings + change bg color
	new cookie('iArrSN_Current', iArrSN, 7, '/').set();
	fnc_SNavRefresh();
	document.location.href = str_SURL;
	
}
//---------------------------------------------------------------------------------------'
//Navigation jumping to external sites
function ExternalNavLink(str_SURL, iArrSN) {

	//expose selected sub headings + change bg color
	new cookie('iArrSN_Current', iArrSN, 7, '/').set();
	fnc_SNavRefresh();
	OpenPopWindow(str_SURL,600,800,"NemoLink",1);
	
}
//---------------------------------------------------------------------------------------'
//Home from breadcrumb route
function ReturnHome() {
	
	//reset all navigation
	fnc_NavReset()
	document.location.href = "/home.asp"
	
}
//---------------------------------------------------------------------------------------'
//reset all navigation
function fnc_NavReset() {
	new cookie('iArrN_Current', -1, 7, '/').set();
	new cookie('iArrSN_Current', -1, 7, '/').set();
	fnc_NavRefresh();
}
//---------------------------------------------------------------------------------------'

//Generic popup window
function OpenPopWindow(strURL,intHeight,intWidth,strTitle,intTools) {

	var winExtProps = "scrollbars=no,menubars=no,toolbars=no,resizable=no"

	if (intTools == 1) {winExtProps = "scrollbars=yes,menubars=no,toolbars=no,resizable=yes";}
	if (intTools == 2) {winExtProps = "";}
	
	var page = strURL
	windowprops = "height=" + intHeight + ",width=" + intWidth + ",location=no,"+ winExtProps;
	window.open(page, "OpenWindow", windowprops);
}