$(document).ready(function() {

    //upraveni category desc pro cycler
    $('#category-desc ul').each(function() {
        var cycleFrame = '<div class="cycle-frame"';
        cycleFrame += 'style="background: url(' + $(this).find('li:eq(5) img').attr('src') + ') no-repeat right bottom;">';
        cycleFrame += '<span class="cf-header abs tk-museo">' + $(this).find('li:eq(0)').text() + '</span>';
        cycleFrame += '<span class="cf-subheader abs tk-museo">' + $(this).find('li:eq(1)').text() + '</span>';
        cycleFrame += '<span class="cf-text abs tk-museo">' + $(this).find('li:eq(2)').html() + '</span>';
        cycleFrame += '<a class="cf-link abs tk-museo np" href="' + $(this).find('li:eq(3) a').attr('href') + '">' + $(this).find('li:eq(3) a').text() + '</a>';
        cycleFrame += '<img class="cf-logo abs" src="' + $(this).find('li:eq(4) img').attr('src') + '" alt="" /></div>';
        $('#cycle').append(cycleFrame);
        $(this).remove();
    });


    $('#cycle').after('<ul id="cycle-nav" class="abs np"></ul>');
    $('#cycle').cycle({
        pager: '#cycle-nav',
        pagerAnchorBuilder: function() {
            return '<li></li>';
        }
    });
    
    $('img').error( function() { if ($.trim($(this).attr('alt')) == "") $(this).hide(); });
});

