$(document).ready(function() {
    blankTarget();

    $("a.fancybox").fancybox({
        'zoomSpeedIn': 300,
        'zoomSpeedOut': 300,
        'overlayShow': true,
        'hideOnContentClick': false,
        'titlePosition'	: 'over',
        'autoDimensions' : true,
        'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
            if(typeof title == 'undefined') title = '';
            return '<span id="fancybox-title-over">(' +  (currentIndex + 1) + ' / ' + currentArray.length + ')&nbsp;&nbsp;&nbsp;' + title + '</span>';
        }
    });
});

function blankTarget()
{
    if(!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for(var i=0; i<anchors.length; i++)
    {
        var anchor = anchors[i];
        anchor.tabindex = i;
        if(anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
        {
            anchor.target = "_blank";
        }
    }
}
