Pan image

Hello there. I have to create an image zoom and pan. The problem is that I have to set some boundaries for my pan to stop when the image is finished. Here is my source code.
Thank you.

http://rapidshare.com/files/216533662/zoomDev_maskCS3.zip.html