$(document).ready(function () {
  // hide answers to all FAQs
  $('.answer_to_faq').hide();
  
  // show any pre-selected FAQ answers
  $('.show_faq_answer').show();
  
  // unobtrusively turn FAQ questions into links to show the answers
  $('span.faq_question').css("cursor","pointer").css("cursor","hand");
  $('span.faq_question').attr("title","click to show/hide answer");
  $('span.faq_question').click(function () { 
    $(this).parent().find('div.answer_to_faq').toggle("blind", { direction: "vertical" }, 400);
  });
  
  // unobtrusively hide the 'Ask a Question' form, unless we're displaying errors for a submitted FAQ
  if ($('div#errorExplanation').length == 0) {
    $('a#ask_new_faq_link').show();
    $('div#new_question').hide();
  };
  
  $('a#ask_new_faq_link').click(function () { 
    $('div#new_question').toggle("blind", { direction: "vertical" }, 400);
    // wait for the form to show up
    setTimeout("$('div#new_question :input:visible:enabled:first').focus();", 410);
    return false;
  });
  
  
});