Refactoring the image space viewer.   First step was to move
as much javascript as possible to an external file.