// collapse all list on initinal setup
function init() {

	document.getElementById('events_sub').style.display = "none";
	//NOTE THAT FACULTY IS COMMENTED OUT BECAUSE SIDE NAV SUB-MENU WAS REMOVED FROM ORIGINAL SIDE NAV MODULE.
	//BE SURE TO COMMENT OUT ANY ADDITIONAL SUB-NAV MENU REFERNECES IF THEY ARE REMOVED FROM THE MODULE OR IT WILL THROW OFF ALL MENUS
	//document.getElementById('faculty_sub').style.display = "none";  
	document.getElementById('research_sub').style.display = "none"; 
	document.getElementById('graduate_sub').style.display = "none"; 
	document.getElementById('undergraduate_sub').style.display = "none"; 
	document.getElementById('awards_sub').style.display = "none"; 
	document.getElementById('departmental_sub').style.display = "none"; 
	
	// get URL of this window
	var url = window.location.href
	
	// now check against URL to know which menu to expand based on current page
	if (url.indexOf("events") != -1) toggle('events_arrow', 'events_sub');
	// awards has to be placed above Faulty, Undergraduate, and Graduate to prevent erroneous menu expansion
	else if (url.indexOf("awards") != -1) toggle('awards_arrow', 'awards_sub');
	//else if (url.indexOf("faculty") != -1) toggle('faculty_arrow', 'faculty_sub');
	else if (url.indexOf("undergraduate") != -1) toggle('undergraduate_arrow', 'undergraduate_sub');
	else if (url.indexOf("research") != -1) toggle('research_arrow', 'research_sub');
	else if (url.indexOf("graduate") != -1) toggle('graduate_arrow', 'graduate_sub');
	else if (url.indexOf("departmental") != -1) toggle('departmental_arrow', 'departmental_sub');
	// graduate has to go last else "graduate" sub-directories of above will catch the "graduate" in URL
	else if (url.indexOf("graduate") != -1) toggle('graduate_arrow', 'graduate_sub');
}


// this function toggles the status of a list 
function toggle(image,list)  { 

	// determine if list style is shown or hidden
	var listElementStyle = document.getElementById(list).style; 
	
	if (listElementStyle.display == "none") {
	 
		listElementStyle.display = "block"; 
	 	
	 	// STEVE, THIS IS WHAT I'M TALKING ABOUT
		document.getElementById(image).src = "http://www.chemistry.gatech.edu/images/icons/arrow-down.gif"; 
		
		document.getElementById(image).alt = "Collapse"; 
	
	} else { 
	
		listElementStyle.display = "none"; 
	 	
	 	// STEVE, THIS IS WHAT I'M TALKING ABOUT
		document.getElementById(image).src = "http://www.chemistry.gatech.edu/images/icons/arrow-right.gif"; 
		
		document.getElementById(image).alt = "Expand"; 
	}
}