How do I get a video embedded in an image file to revert to the when done playing?

I’m using the site freevideocoding.com to help me play a video when an image is clicked on a website. The code it generates goes something like this:

<div><img src=“http://xxxxx.jpg” height=“390” width=“695” alt=“” style=“cursor: pointer;” onclick=“this.parentNode.innerHTML = ‘\x3Cembed src=\‘http://xxxxx.mp4\’ width=\‘695\’ height=\‘390\’ autoplay=\‘true\’ controller=\‘false\’ type=\‘video/quicktime\’ scale=\‘tofit\’ pluginspage=\‘http://www.apple.com/quicktime/download/\\’\x3E \x3C/embed\x3E’;”></div>

It works fine, a video starts playing when you click the image, but then when the video finishes it just stops. What I want it to do is go back to the original source image when the video finishes playing. Is there a way to do that? I’ve tried playing around with the onfinish command but haven’t had any luck. Can anyone help out? Thanks