javascript a bit organized and handlers added for marksheet selection