Welcome to the p2p.wrox.com Forums.
Please look at http://www.wmsviewer.com/
You`ll see a map, where one can draw squares etc. to zoom this area in or out.
I`m curious about how can I do the same effect, I mean drawing on images dynamicly?
Well it's obviously quite complicated, there is some server-side code that you can't see for actually getting the images required at each stage but there's a lot of client-side code that you can examine just by using view source etc.