Set up attachment viewing functions and JS Object