Moving image loading code to static.js