//This file shows and hides subnavigation items in navPrefs based on whether or not the parent item is on or off.
//It is only necessary to call this file and these functions in the body onLoad tag of navPrefs.html

//This function automatically hides subnav if the parent has previously been set to off
function autoHider()
{
	for (i in linkStatus)
	{
		if (linkStatus[i] == 'false') //Runs through all Links and pulls the links marked as false
		{	 
			if (document.getElementById('Link'+[i]+'Second') != null) //checks to see if the Link has a child
			{
				document.getElementById('Link'+[i]+'Second').style.display = 'none'; //Hides the Child 
			}
		}
	}
}

//Function to automatically populate the navigation preferences saved from prior sessions, or display all as checked when no preference have been set
function autofill()
{
for (var i=0; i <= document.navPrefs.elements.length-1;i++)
	{
 	if (linkStatus[i] == 'false')
 	{}
 	else 
 	document.navPrefs.elements[i].checked = true;
	}
}

//ends autofill

//This function is called to show or hide a child when a parents is turned on or off as a person edits their navigation preferences

function toggleHide(objname){
  if(document.getElementById(objname).style.display == "none"){
    // Child is hidden, so show it
    document.getElementById(objname).style.display = 'block';
  }else{
    // Child is showing, so hide it
    document.getElementById(objname).style.display = 'none';
  }
}

function Hide(objname){
    document.getElementById(objname).style.display = 'none';
}