better interface between template and javascript
move case details javascript to separate file
wrap case details js in document.ready