//the main function, call to the effect object
function init(){

  var stretchers = document.getElementsByClassName('stretcher'); //element that stretches
  var toggles = document.getElementsByClassName('toggle'); //elements where I click on

  //accordion effect
  var myAccordion = new fx.Accordion(
    toggles, stretchers, {opacity: true, duration: 400}
  );

  //hash functions
  var found = false;
  toggles.each(
    function(a, i){
      a.href = "#"; //change href of anchor
      var ul = Element.find(a, 'nextSibling'); //get following ul
      //determine active toggle
      if (a.attributes['class'].nodeValue.search(/active/) != -1) {
        myAccordion.showThisHideOpen(ul);
        found = true;
      }
    }
  );
  if (!found) myAccordion.showThisHideOpen(stretchers[0]);
}
