/* adds show/hide functionality to FAQ list
   - FAQ must be in <div id="makefaqlist"><dl>
   - Uses Mootools - mootools-1.2.1-core.js and mootools-plugins.js
*/

window.addEvent('domready', function() {
  if ( $('faqimage') ) $('faqimage').dispose();
  // change the class, so style from faq.css is applied
  $('makefaqlist').addClass('faqlist');
  
  // add <a> tags to questions, so tab navigation hits them
  $$('.faqlist dt').each( function(listItem, index) {
    var theLink = new Element('a', { 'href': document.location.href, text: listItem.get('text') });
   
    listItem.empty();
    listItem.grab(theLink);
  });

  var myAccordion = new Accordion($$('.faqlist dt a'), $$('.faqlist dd'), { 
    alwaysHide: 'true',
    display: -1,
    show: -1,
    onActive: function(toggler, element) { toggler.getParent().addClass('current'); },
    onBackground: function(toggler, element) { toggler.getParent().removeClass('current'); }
  });
  
  $$('.faqlist dt a').addEvent('click', function() { return false; });

  setContentDims();  // fix page dimensions for IE6
});