This just might be the most awesome JavaScript I have written in the better part of a decade.

function sortEnd() {
  $('thead th', this).each(function() {
 

    var $className = $(this).attr('class');
    var $anchor = $('a', this);
    var titleText;

    switch ($className) {
      case "headerSortUp":
        titleText = $anchor.text() + ', sorted acending';
        break;
      case "headerSortDown":
        titleText = $anchor.text() + ', sorted decending';
        break;
      default:
        titleText = $anchor.text() + ', sort by';
    }

    $anchor.attr('title', titleText);
    $anchor.attr('alt', titleText);

  });
};