Added the sort button tweak to the custom template

changed javascript function handleLinks (util.js) to add click handling for sort buttons.