$(document).ready(function() {
    $(this).run();
});

jQuery.fn.run = function() {

    var context = this;
    
    $('a[href$=.jpg],a[href$=.JPG],a[href$=.jpeg],a[href$=.png],a[href$=.gif]', context).each(function() {
        $(this).fancybox({'titlePosition':'inside','overlayShow':true,'centerOnScroll':true});
    });

    return this;

};
