$(document).ready(function() {
  var toggleMinus = '[-]';
  var togglePlus = '[+]';
  var $Head = $('tbody tr.group-header th:last-child');

  $Head.prepend('<strong>' + toggleMinus + '</strong>');
  $('strong', $Head).addClass('clickable').click(function() {
    var toggleSrc = $(this).text();

    if ( toggleSrc == togglePlus ) {
      $(this).text(toggleMinus).parents('tr').siblings().fadeIn();
    } else{
      $(this).text(togglePlus).parents('tr').siblings().fadeOut();
    };
  });

  var showInfo = 'Show Info';
  var hideInfo = 'Hide Info';
  
  $('[class^=hideshow]').before('<span id="toggler" class="float-right">'+showInfo+'</span>');
  
  $('tr.parent-with-details').css("cursor","pointer").attr("title","Click to expand/collapse").click(function(){
    if ($(this).find('span#toggler').text()==showInfo) {
      $(this).find('span#toggler').text(hideInfo);
    } else {
      $(this).find('span#toggler').text(showInfo);
    }
    $(this).siblings('.child-' + this.id).toggle();
  });

});


