(function($){

  $(function() {
    // document ready
    $('a.collapse, a.uncollapse').each( function() {

      var selfCol = !($(this).hasClass('uncollapse'));
      var selfTit = $(this).attr('title');

      $(this)
        .attr('alt',selfTit)
        .attr('title',selfTit.split('/')[selfCol?0:1]);

      $(this)
        .click( function() {
          var selfId = $(this).attr('id').split('_')[1];
          var selfCol = !($(this).hasClass('uncollapse'));
          var selfTit = $(this).attr('alt');
          if (selfCol) {
            $(this).attr('class','uncollapse').attr('title',selfTit.split('/')[selfCol?0:1]);
            $('#child_'+selfId).removeClass('collapse');
          }
          else {
            $(this).attr('class','collapse').attr('title',selfTit.split('/')[selfCol?0:1]);
            $('#child_'+selfId).addClass('collapse');
          }
        });
    });
  });

})(jQuery);



