Can't you just do this in HTML?
code:
<img src="blah.png" width="100" height="100">
That would (I believe) make the picture fit those dimensions, so you could, in theory, just do that, and then make that picture a link to the full sized picture that's sitting on your server. Something like this:
code:
<a href="blah.png" title="Click to enlarge"><img src="blah.png" width="100" height="100"></a>
IMO, that'd be a lot easier than using the crazy Javascript and it also means that you're not reliant on other people having a Java-enabled browser.