var questions = document.getElementsByTagName('dt');
var answers = document.getElementsByTagName('dd');

function displayToggle(){
     for (i=0; i<questions.length; i++) { // loops through the questions

        questions[i].onclick=function() { // displays the question 
            on clickvar next = this.nextSibling;
            // if it gets to a non-element node, go to the next 
            while(next.nodeType != 1) next=next.nextSibling; 
            onenext.className=((next.className=="hide") ? "show" : "hide");
         }
      }
}

window.onload=function() {displayToggle();}

// function for the link that turns them all off
function toggleAllOff(){
     for (var i = 0; i < answers.length; i++) {
        answers[i].className = 'hide';
     }
}
        
// function for the link that turns them all on
function toggleAllOn(){
     for (var i = 0; i < answers.length; i++) {
        answers[i].className = 'show';
     }
}

function displayToggle(){
     // calls the toggle all off function 
     // to turn all the answers off when the page is loaded     
     toggleAllOff(); 

     for (i=0; i<questions.length; i++) {  // loops through the questions
         questions[i].onclick=function() {  // shows the answers onclick
             var next = this.nextSibling;
             // if it gets to a non-element node, go to the next one
             while(next.nodeType != 1) next=next.nextSibling; 
             next.className=((next.className=="hide") ? "show" : "hide");
          }
      }
}

// -----Simpler toggle, not for Q&A, added by Amanda 11/09/10
function toggleDisplay(theID) {
 if (document.getElementById(theID).style.display=="block") { document.getElementById(theID).style.display="none" }
 else { document.getElementById(theID).style.display="block" } 
}
