moved javascript functions

I moved the javascript functions into another file so other views can
access the same functionality of the popup windows with the shaded
background.