$(document).ready(function() {
 $('#tree ul').hide();
  $('#tree li:has(ul)').each(function(i) {
    $(this).children().slideUp(400);
  });

  $('.p1').click(function(event) {
      current = this;
      $('#tree li:has(ul)').each(function(i) {
        if (this != current) { $(this).children().slideUp(400); }
      });
      $(this).children('ul:eq(0)').slideToggle(400);
    
  });
});


