function accordion(el) {
    var elup;

    el = document.getElementById(el).getElementsByTagName("h5")[0];

 

    if (Element.hasClassName(el.parentNode.id+'-body','visible')){
        //do not need to perform an actions
        return;
    }
    var eldown = el.parentNode.id+'-body';
    var apanels = document.getElementsByClassName('panel_body',el.parentNode.parentNode);
    for (var i=0;i<apanels.length;i++){

        if (Element.hasClassName(apanels[i].parentNode.id+'-body','visible')) {
            elup = apanels[i].parentNode.id+'-body';
            document.getElementById(apanels[i].parentNode.id).getElementsByTagName('h5')[0].setAttribute("class", "panel_title");
        }
    }
    if (elup){
      new Effect.Parallel([ new Effect.SlideUp(elup), new Effect.SlideDown(eldown) ], {duration: 0.5});
        Element.removeClassName(elup,'visible');
        Element.addClassName(eldown,'visible');
        el.setAttribute("class", "open");
    } else {
        //DNA: Added for when no panels are open.
      new Effect.SlideDown(eldown, {duration: 0.5});
        Element.addClassName(eldown,'visible');
      
        el.setAttribute("class", "open");
    }
}

//pass in ID of container element that has all instances of apanels
function accordion_init(id) {
    var apanels = document.getElementsByClassName('panel_body',id);
    for (var i=0;i<apanels.length;i++){
        apanels[i].style.display = 'none';
    }
    var velems = document.getElementsByClassName('visible');
    for (i=0;i<velems.length;i++){
        $(velems[i]).style.display = 'block';
    }
}


function menu_init() {
    var menuButtons = document.getElementById('mainmenu').getElementsByTagName("img");
    for (var i=0;i<menuButtons.length;i++){
        var currentButton = menuButtons[i];
        var imageFilename = currentButton.src;
        if (imageFilename.substr(imageFilename.length-11, imageFilename.length) != "-active.gif") {

            currentButton.setAttribute("onMouseOver", "menuMouseOver(this)");
            currentButton.setAttribute("onMouseOut", "menuMouseOut(this)");

        }

    }

}
function menu_all() {
    accordion_init();
    menu_init();

}

function menuMouseOver(img) {
    //img.src = img.src.SubString( 0, str.Length() - 4 )+"-active.gif";
    odlScr = img.src;
    img.src = odlScr.substr( 0, odlScr.length - 4 )+"-active.gif";

}
function menuMouseOut(img) {
    odlScr = img.src;
    img.src = odlScr.substr( 0, odlScr.length - 11 )+".gif";

}

//The following line was added as I couldn't get the addEvent() lines to work from Brian's Code sample on the scriptaculous wiki. This approach works in both Firefox 1.5 and IE 6.
window.onload = menu_all;
		


