function dfFancyboxTitleFormat(title, currentArray, currentIndex, currentOpts)
{
    var resultTitle = "<strong>" + title + "</strong>";

    if ($('#lightbox-caption' + currentArray[currentIndex].id.substr(8)).length)
    {
        resultTitle += "<br \/>" + $('#lightbox-caption' + currentArray[currentIndex].id.substr(8)).html();
    }
    
    return resultTitle;
}

$(function() {
    //ezImage - Lightbox
    $("a[rel^='lightbox']").fancybox({
        'autoScale'     : true,
        'titlePosition' : 'inside',
        'titleFormat'   : dfFancyboxTitleFormat,
        'transitionIn'  : 'elastic',
        'transitionOut' : 'elastic',
        'easingIn'      : 'easeOutBack',
        'easingOut'     : 'easeInBack',
        'scrolling'     : 'yes'
    });
    $("a.iframe").fancybox({
        'frameWidth'    : 560,
        'frameHeight'   : 320
    });
    //Navigator - GoToPage Textfield
    function gotopage(event) {
        if (event.keyCode == 13) {
            var item_limit = $('#gotopage_item_limit').html();
            var location_href = $('#gotopage_location_href').html();
            var location_new = location_href.substr(0, location_href.search('%%%')) + ($(this).attr('value') * item_limit - item_limit) + location_href.substr(location_href.search('%%%') + 3);
            document.location.href = location_new;
        }
    }
    $('.gotopage').focus(function() {
        if ('...' == $(this).attr('value'))
            $(this).attr('value', '');
        $(this).keyup(gotopage);
    });
    $('.gotopage').blur(function() {
        if ('' == $(this).attr('value'))
            $(this).attr('value', '...');
        $(this).unbind('keyup', gotopage);
    });
});