add progress dialog styles
Load javascript after html

Reformatted template and moved javascript loading to the end of the
template to improve page responsiveness.