Javascript Check If Image Is Rendered