jQuery(document).ready(function($)
{
  var hash = location.hash;
  $(hash).addClass('highlight');
  
  $('.each-testimonial').mouseenter(function() {
    $('.each-testimonial').removeClass('highlight');
    $(this).addClass('highlight');
  });
});

jQuery(document).ready(function($)
{
  $('ul.tabs').tabs('div.panes > div',
    {
      event: 'mouseover'
    }
  );
  
  $('ul.tabs a').click(function() {
    rel = $(this).attr('rel');
    window.location = rel;
  });
});

jQuery(document).ready(function($)
{
  $firstDropdown = $('#expert-identity');
  $secondDropdowns = $('#expert-needed-for select');

  $firstDropdown.change(filterOptGroups);
  $firstDropdown.trigger('change');
  
  $secondDropdowns.change(goToPageFromSelect);
  
});

function filterOptGroups()
{
  firstValue = $(this).val();
  
  $($secondDropdowns)
    .hide()
    .filter(
      function(index){
        name = $(this).attr('name');
        return name == firstValue;
      })
    .show();
}

function goToPageFromSelect()
{
  selectedValue = $(this).val();
  window.location = selectedValue;
}

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>';

  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);
});

function hideAllAnswers()
{
  $(hideAllButton).addClass('faq-hide-all-active');
  $(showAllButton).removeClass('faq-show-all-active');
    
  $(answers).slideUp('fast');
  $(questions).find('.question-toggle').replaceWith(showMarkup);
}

function showAllAnswers()
{
  $(showAllButton).addClass('faq-show-all-active');
  $(hideAllButton).removeClass('faq-hide-all-active');
    
  $(answers).slideDown('fast');
  $(questions).find('.question-toggle').replaceWith(hideMarkup);
}
function showAnswer()
{
  $(showAllButton).removeClass('faq-show-all-active');
  $(hideAllButton).removeClass('faq-hide-all-active');
    
  $(this).next('.faq-answer').slideDown('fast');
  $(this).find('.question-toggle').replaceWith(hideMarkup);
}

function hideAnswer()
{
  $(showAllButton).removeClass('faq-show-all-active');
  $(hideAllButton).removeClass('faq-hide-all-active');

  $(this).next('.faq-answer').slideUp('fast');
  $(this).find('.question-toggle').replaceWith(showMarkup);
}









