﻿// JScript File

//array of all the menu sections

var navMenu = new Array(["tvmenu1"],["tvmenu2"],["tvmenu3"],["tvmenu4"],["tvmenu5"],["tvmenu6"],["tvmenu7"],["tvmenu8"]); 



//initialize flag array to keep track of which menu is open

for (j=0; j<navMenu.length; j++) {



//set up a flag for each menu, to tell whether it's on or off

 	navMenu[j][1]=0;

	// sets all menu flags as "off"

	// indicating that all menus are thought to be invisible

}



function openMenu(strOpen) {

	for (i=0; i<navMenu.length; i++){ 

	// find the menu

		if ((navMenu[i][0]==strOpen)&&(navMenu[i][1]==0)){

		// check the menu's state

		

			show(navMenu[i][0]);

			// show the menu, because it's not visible

			

			navMenu[i][1]=1;

			// set the flag indicating the menu state is visible

			

			break;

			// break out of the function, we've found our menu

		}

		else if ((navMenu[i][0]==strOpen)&&(navMenu[i][1]==1)){

		//check the menu's state

		

			hide(navMenu[i][0]);

			//hide the menu, because it's already open

		

			navMenu[i][1]=0;

			//set the flag indicating the menu state is hidden

		

			break; 

			// break out of the function, we've found our menu

		}

	}

}



function hide(str) {

x = document.getElementById(str);

x.style.display = 'none'; // hide the element

flagState = 0; // now it's off, keeping track of its state

}

function show(str) {

x = document.getElementById(str);

x.style.display = 'block'; // show the element

flagState = 1; // now it's on, keeping track of its state

}