jsortable.tpl - Removed buggy function

I really don't know what this function was attempting to do but it was crashing jQuery.
Note.tpl - Add clause to prevent javascript crash
attachment.tpl - cleanup related to js clear buttons
CRM-14612 - Fix relationship permission checkboxes
Merge pull request #3177 from colemanw/cleanup

Various fixes and cleanup