$(function(){

    $('.bestseller').each(function(){
        var adr = '/bestseller.php?ident=' + $(this).attr('id');
        $(this).load(adr, '', function(html, wynik){
            if ((wynik == 'success') && (html != '0')) {
                var t = $('<div class="ok-bestseller"><strong>Bestseller</strong> <a href="http://helion.pl/katalog/bestsellery,0,0,3.html">#' + html + '</a></div>');
                $(this).replaceWith(t);
                $(t).css({opacity: 0}).animate({opacity: 1.0}, 2000);
            } else {
                $(this).remove();
            }
        });
    });

    $('#tytul .info-bestseller a').each(function(){
        var ksiazka = $(this).attr('class');
        var adr = '/bestseller.php?ident=' + ksiazka;
        $(this).load(adr, '', function(html, wynik){
            if ((wynik == 'success') && (html != '0')) {
                $(this).html('<strong>Bestseller</strong> #' + html);
                $(this).show().css({display: 'block', opacity: 0}).animate({opacity: 1.0}, 2000);
            } else {
                $(this).remove();
            }
        });
    });



});
