The imgViewer widget is built using the jQuery UI Widget Factory. Extending the functionaity of the widget is a relatively simple process as described in Extending Widgets with the Widget Factory.
As an example
$.widget("wgm.imgExtension", $.wgm.imgViewer, {
options: {
}
});