Hi!
I'm not sure if you've been able to do this already, but just as a heads-up: try using the field class instead of id if possible. An id should be unique and "officially" should not be defined more than once on one page. You could perhaps even make it look for every <img> tag and thus automate the process all together.
Remember: the modules within CCMS are indications of what can be done. CCMS is flexible enough, like you already did

, to have other frameworks and scripts integrated.
Good luck!
Xander.