Use of main template's JS to implement read/unread function