/*window.onload = toggle;*/
var visible = "0";

function next(elem) {//Function searches through siblings until it reaches an element (non text) node
	do{
		elem = elem.nextSibling;
	} while (elem && elem.nodeType !=1)
	return elem;
}

function toggleIt(){//Function creates actual toggle
	var associatedDD = next(this);
	if(visible==1){	
	associatedDD.className = "displayOff";
	this.className = "dtdisplayOff";
	visible=0;
	}else {
	associatedDD.className="displayOn";
	this.className = "dtdisplayOn";
	visible=1;
	}
}

function toggle() {
	var faqSection = document.getElementById("faq");//grabs the definition list with questions
	if(!document.getElementById) return;//exit if not available
	if(!document.getElementsByTagName) return;//exit if not available
	if(!faqSection) return;//exit if id is not on the page 
		
	var definitionTerms = faqSection.getElementsByTagName("dt");//gets the array of definition terms
	var definitionDef = faqSection.getElementsByTagName("dd");//gets the array of definition terms
	var counter = definitionTerms.length;
	var index;
	for(index=0; index<counter;index++) {//Finds the next sibling element dd using function above	
		definitionDef[index].className = "displayOff";//Sets display of dl definitions to off on start up
		definitionTerms[index].className = "dtdisplayOff";
		definitionTerms[index].onclick = toggleIt;
	}
}


	
	
