Ported inline javascript to report.js file