Refactored JQuery handlers in compshare.js into functions.