/**
 * Onload handler for JS accordion.
 *
 * Applies accordion behavior to links with class "acc-item".
 * Each accordion item should be formatted in the following manner.
 * P contains the contents to be revealed and is default hidden via CSS.
 *
 * <div>
 *     <a href="#">Name of Link</a>
 *     <p>
 *        Text to be revealed
 *     </p>
 * </div>
 * 
 */
  
$(function() {

   $("a.acc-item").bind('click', function() {   
      var target = $(this).parent().find("p");
      var openAccItem = $("#accordion p").filter(":visible");
 
      $(this).addClass("on");
 
      if(openAccItem.length < 1) {
         $(target).slideDown("fast");      
      } else {
         $(openAccItem).parent().find("a.acc-item").removeClass("on");   

         $(openAccItem).slideUp("fast",function() {
            $(target).slideDown("fast");
         });
      }
      
      return false;
   });
   
});




