﻿//do stuff when DOM is ready
$(document).ready(function() {
    $('ul#neoTracFAQ').removeClass('compact').addClass('faq').find('li').each(function(i) {
        var question = $(this).find('a[@href*="#"]');
        var answer = $(question.attr('href'));
        //question.prepend('<span class="listItem">Q:</span> ');
        //answer.prepend('<span class="listItem">A:</span> ');
        
        //remove the 'back to top' link
        answer.appendTo(question.parent()).addClass('answer').hide().find('h2').remove().end().find('a[@href="#main"]').parent().remove();
        
        
        //set the question links so that the answers are hidden and shown when the user clicks on the question
        question.toggle(
            function() {
                $(this).addClass('active').parent().find('div.answer').slideDown('normal');
            }
            , function() {
                $(this).removeClass('active').parent().find('div.answer').slideUp('normal');
            }
        );
    });
});
