How can I add a ‘Click to Enlarge Image’ feature, with the enlarged image opening in a popup?

You should use a lightbox for this. Try this one. It works well

http://lokeshdhakar.com/projects/lightbox2/

There are instructions on how to use it and documentation on how to get it working. The download will also contain samples and you can just copy and paste the code.