jQuery(document).ready(
    function() {
        $("#helpdoc-element-screenshot .helpdoc-screenshot a").each(function () {
            var a = $(this)
            if (a.data('mime') == "Video") {
                a.prepend($('<div id="video-overlay">')); // a little arrow image indicate this is a video
                a.fancybox({
                    type: 'iframe',
                    width: 640,
                    height: 400
                });

            } else {
                a.attr('rel', 'gallery').fancybox({
                    'titlePosition': 'outside',
                    'titleFormat': function (title, currentArray, currentIndex, currentOpts) {
                        return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
                    }
                });

            }
        });
        
    }
);