// JavaScript Document
// show selected id in content area
function showID(id) {
	$("div[@id^=bio]").hide(); // hides all bios beginning with id's beg with "bio"
	$("#" + id).show();
}

// runs on load to get targeted bio if provided after #
function showOnLoad() {
	var bio = getHashName();
	if(bio != "") {
		$("#bio" + bio).show();
	} else {
		$("#bio0").show();
	}
}

// gets the value after the # in the url string
function getHashName() {
  var hash = self.document.location.hash.substring(1);
  return hash;
}

// figures out which menu to expand when opened with # bio number in url string change if() values accordingly
function getDefaultExpanded () {
	var hash = self.document.location.hash.substring(1);
	if(hash >= 1 && hash <= 6) {
		return 0;
	} else if(hash >= 7 && hash <= 12) {
		return 1;
	} else if(hash >= 13 && hash <= 20) {
		return 2;
	} else if(hash >= 21 && hash <= 26) {
		return 3;
	} else if(hash >= 27 && hash <= 30) {
		return 4;
	} else {
		return;
	} 
 
}

ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [getDefaultExpanded()], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='images/people/plus.gif' class='statusicon' />", "<img src='images/people/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})