var aNextElement = [];

$(function() {
    if (aNextElement.length)
    {
        var bSelf = false;
    
        for (var i = 0; i < aNextElement.length; i++)
        {
            var nextElement = $('#nextElement' + aNextElement[i][0] + ' + *');
            var slimboxImage = aNextElement[i][2];
            
            if (slimboxImage != '')
            {
                if (nextElement[0].tagName == 'DIV')
                {
                    nextElement = nextElement.find('img');
                }
    
                nextElement.wrap('<a href="' + slimboxImage + '" rel="lightbox"></a>');
            }
        }
        
        $("a[rel^='lightbox']").fancybox({
            'imageScale': true,
            'titlePosition' : 'inside',
            'titleFormat'   : dfFancyboxTitleFormat,
            'transitionIn'  : 'elastic',
            'transitionOut' : 'elastic',
            'easingIn'      : 'easeOutBack',
            'easingOut'     : 'easeInBack',
            'scrolling'     : 'yes'
        });
    }
});