$(document).ready(function() {
        $("a[href$='jpg']:has(img)").addClass('colorbox');
        $("a[href$='JPG']:has(img)").addClass('colorbox');
        $("a[href$='gif']:has(img)").addClass('colorbox');
        $("a[href$='GIF']:has(img)").addClass('colorbox');
        $("a.colorbox, area.colorbox").each(function () {
            if (!$(this).attr('rel')) $(this).attr('rel', 'colorbox');
            if (!$(this).attr('title')) $(this).attr('title', $('img', this).attr('title'));
            if (!$(this).attr('title')) $(this).attr('title', $('img', this).attr('alt'));
        });
    $("a.colorbox, area.colorbox").colorbox({
        contentCurrent : '{current} z {total}',
        current : '{current} z {total}',
        contentPrevious : 'poprzedni',
        previous : 'poprzedni',
        contentNext : 'nast\u0119pny',
        next : 'nast\u0119pny',
        modalClose : 'zamknij',
        close : 'zamknij',
        //overlayClose : true,
        transitionSpeed : 100,
        transition : 'elastic'
    });
    $('input[type=file]').change(function() {
        $('#'+$(this).attr('name')+'-txt').attr('value', $(this).attr('value'));
    });
    $('input.anuluj').click(function() {
        location.href = './';
    });
    try { $('input.date').datepicker(); } catch (e) { }
    try { $('.ui-tabs').tabs(); } catch (e) { }

});

function onFlashEnd(flashId, callback) {
    var timer = function() {
        try {
            var obj = $(flashId)[0];
            return obj.IsPlaying() ? setTimeout(timer, 100) : callback(obj);
        } catch (e) {
            setTimeout(timer, 100);
        }
    }
    setTimeout(timer, 100);
}

