Async javascript and image loading