Topic: Count image hits - run javascript when image is viewed?

I keep track of how many times my images have been viewed with my other two gallery solutions by using a java script to trigger a php-script. What I do is that I send an ID to a php-page and the php-page handles the database stuff.

    <!-- START setStats -->
      <script type="text/javascript">
      document.write('<' + 'script src='' + 2547 + ''></' + 'script>');     

    <!-- SLUT setStats -->

Now I would like to be able to do something similar when an image is displayed in SimpleViewer. Is that possible?