/* Toggle button JavaScript framework, * Adapted by Brian Kroeker from somewhere on the Internet * /*--------------------------------------------------------------------------*/ /* Hide all displayed divs, then change the one passed in to be displayed */ function toggleMe(myText,myButton,numToggleDivs){ var mytext=document.getElementById(myText); var mybutton=document.getElementById(myButton); if(!mytext)return true; if(!mybutton)return true; var initialState = "closed"; if (mytext.style.display=="block") { initialState = "open"; } /* If no total number of toggle divs given, set to 0 so that the for loop will not execute, and thus no divs will be automatically hidden */ if(!numToggleDivs) { var numToggleDivs=0; } /* Hide all divs from displaying and set all button icons to the minus image */ for(count=1; count<=numToggleDivs; count++) { var divDisplayed=document.getElementById('heading' + count); var buttonDisplayed=document.getElementById('button' + count); divDisplayed.style.display="none"; swapImage(buttonDisplayed,"plus"); } /* Get the desired div and button and hide or unhide it */ if (initialState == "closed") { mytext.style.display="block"; swapImage(mybutton,"minus"); } else{ mytext.style.display="none" swapImage(mybutton,"plus"); } return true; } /* Hide all displayed divs, then change the one passed in to be displayed */ function toggleDiv(myDivNum,numToggleDivs){ var mypara=document.getElementById('para' + myDivNum); var myhyper=document.getElementById('hylink' + myDivNum); var mydiv=document.getElementById('heading' + myDivNum); if(!mydiv)return true; /* If no total number of toggle divs given, set to 0 so that the for loop will not execute, and thus no divs will be automatically hidden */ if(!numToggleDivs) { var numToggleDivs=0; } /* When the page initially loads, we want to close all divs */ for(count=1; count<=numToggleDivs; count++) { var paraDisplayed=document.getElementById('para' + count); var hyperDisplayed=document.getElementById('hylink' + count); var divDisplayed=document.getElementById('heading' + count); paraDisplayed.style.backgroundColor="#ffffff"; hyperDisplayed.style.color="blue"; divDisplayed.style.display="none"; } /* Get the desired div and button and display it */ /* There is a bug in Firefox that doesn't allow the changing of the background colour of the text colour in this manner, so set the colours right now to the default ones. */ mypara.style.backgroundColor="#b5111a"; myhyper.style.color="white"; mydiv.style.display="block"; return true; } /* The above version supercedes this one, so this one is commented out function toggleMe(myText,myButton){ var mytext=document.getElementById(myText); var mybutton=document.getElementById(myButton); if(!mytext)return true; if(!mybutton)return true; if(mytext.style.display=="none"){ mytext.style.display="block"; swapImage(mybutton,"minus"); } else{ mytext.style.display="none" swapImage(mybutton,"plus"); } return true; } */ function swapImage(myImage,state) { if (state=="minus"){ myImage.src = "/images/cmpt/bullets/minus.png"; } else { myImage.src = "/images/cmpt/bullets/plus.png"; } }