jQuery(document).ready(function($) {
    
    $('h1').textShadow();
    
    $('ul#main-menu')
        .supersubs({
            maxWidth:    35,
            minWidth:    15
        })
        .superfish({
            animation:   {opacity:'show',height:'show'},
            easing:      'easeOutBack'
        })
        .find('ul').bgIframe({opacity:false});

    $("a[href*=.flv]").flowplayer(
        {
            src: "site_addons/flowplayer/flowplayer.swf",
            wmode: "transparent"
        },
        {
            clip: {
                autoPlay: false
            }
        }
    );

    $('#home-slider').nivoSlider({
        effect:     'random',
        slices:     10,
        animSpeed:  500,
        pauseTime:  8000
    });
    
});

jQuery(document).ready(function($) {
 
  showMarkup = '<span class="question-toggle show"><span>[+]</span></span>';
  hideMarkup = '<span class="question-toggle show"><span>[&ndash;]</span></span>';
 
  explanationMarkup = '<div class="faq-explanation">' + 
    '<p class="faq-explanation-info">Click on a question to expand the answer.</p>' +
    '<span class="faq-show-all">Show All</span>' +
    '<span class="faq-hide-all">Hide All</span>' +
    '</div>';

    var hideAllAnswers = function()
    {
      $(hideAllButton).addClass('faq-hide-all-active');
      $(showAllButton).removeClass('faq-show-all-active');
        
      $(answers).slideUp('fast');
      $(questions).find('.question-toggle').replaceWith(showMarkup);
    }
     
    var showAllAnswers = function()
    {
      $(showAllButton).addClass('faq-show-all-active');
      $(hideAllButton).removeClass('faq-hide-all-active');
        
      $(answers).slideDown('fast');
      $(questions).find('.question-toggle').replaceWith(hideMarkup);
    }
    
    var showAnswer = function()
    {
      $(showAllButton).removeClass('faq-show-all-active');
      $(hideAllButton).removeClass('faq-hide-all-active');
        
      $(this).next('.faq-answer').slideDown('fast');
      $(this).find('.question-toggle').replaceWith(hideMarkup);
    }
     
    var hideAnswer = function()
    {
      $(showAllButton).removeClass('faq-show-all-active');
      $(hideAllButton).removeClass('faq-hide-all-active');
     
      $(this).next('.faq-answer').slideUp('fast');
      $(this).find('.question-toggle').replaceWith(showMarkup);
    }
 
    questions = $('.faq-question');
    $(questions).eq(0).before(explanationMarkup);
    
    answers = $(questions).next('.faq-answer');
    $(answers).hide();  
    
    $(questions).prepend(showMarkup);
    $(questions).toggle(showAnswer, hideAnswer);
    
    showAllButton = $('.faq-show-all');
    hideAllButton = $('.faq-hide-all');
    
    $(showAllButton).click(showAllAnswers);
    $(hideAllButton).click(hideAllAnswers);
});
