2     'Przekaż 1% żeby ukryć ten baner.',
 
   3     'Jak dobrze wydać 1% swojego podatku? <strong>Poradnik dla opornych</strong>.',
 
   4     'Wiadomość systemowa: wystąpił błąd brak funduszy. Wykonaj procedurę 1%.',
 
   5     '<strong>FREE!</strong> Wygraj darmowe lektury!',
 
   6     'Confidential business offer. Not scam! 1% for you.',
 
   7     'Biblioteka Wolne Lektury wymaga aktualizacji. Kliknij dalej.',
 
   8     '1000 lektur. <strong>1 procent</strong>.',
 
   9     '1% dla biblioteki lektur szkolnych. 1% dla Twojej biblioteki.',
 
  10     '1% na lektury szkolne.',
 
  11     '1% dla wolności lektur szkolnych.',
 
  12     'Podaruj Jeden Procent na rzecz szkolnej biblioteki internetowej.',
 
  13     '1% podatku dla biblioteki szkolnej Wolne Lektury.',
 
  14     '1% na rzecz darmowego dostępu do szkolnych lektur.',
 
  15     'Żeby czytać teksty a nie skany. Przekaż 1%.',
 
  16     'Czytaj teksty a nie skany. Przekaż 1%',
 
  17     'Motyw artysty w literaturze - 47 cytatów. Pomóż znaleźć następne.',
 
  18     'Twój 1% uwolni więcej lektur.',
 
  19     'Ponad 400 motywów, blisko 10 000 000 cytatów. Pomóż znaleźć następne. Przekaż swój 1%.',
 
  20     'Twój 1% uwolni lektury.',
 
  21     'Rozlicz swój PIT z Wolnymi Lekturami. Skorzystaj z darmowego programu do rozliczania podatków.',
 
  22     'Lektury 2010: Pan Tadeusz, Trylogia.',
 
  23     'Pan Tadeusz też chce być w Internecie! Przekaż 1% swojego podatku.',
 
  24     'Pomóż uwolnić 286 utworów z listy lektur szkolnych. Przekaż swój 1% na Wolne Lektury.'
 
  28 function changeBannerText() {
 
  29     var index = Math.floor(Math.random() * BANNER_TEXTS.length);
 
  30     if (BANNER_TEXTS[index] == $('#onepercent-text').html()) {
 
  34         $('#onepercent-text').fadeOut('slow', function() {
 
  35             $(this).html(BANNER_TEXTS[index]);
 
  36             $(this).fadeIn('slow');
 
  39         setTimeout(changeBannerText, 30 * 1000);
 
  43 function autocomplete_result_handler(event, item) {
 
  44     $(event.target).closest('form').submit();
 
  46 function serverTime() { 
 
  48     $.ajax({url: '/katalog/zegar/', 
 
  49         async: false, dataType: 'text', 
 
  50         success: function(text) { 
 
  51             time = new Date(text);
 
  52         }, error: function(http, message, exc) {
 
  60         $('form input').labelify({labelledClass: 'blur'});
 
  62         target = $('#login-register-window div.target');
 
  64         $('#show-registration-form').click(function() {
 
  65             $('#login-form').hide();
 
  66             $('#registration-form').show();
 
  69         $('#show-login-form').click(function() {
 
  70             $('#registration-form').hide();
 
  71             $('#login-form').show();
 
  75         $('.fragment-text').each(function() {
 
  76             if ($(this).prev().filter('.fragment-short-text').length) {
 
  78                     function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
 
  79                     function() { $(this).css({background: '#FFF'}); }
 
  81                     $(this).fadeOut(function() {
 
  82                         $(this).prev().fadeIn();
 
  89         $('.fragment-short-text').click(function() {
 
  90             $(this).fadeOut(function() { $(this).next().fadeIn() });
 
  93             function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
 
  94             function() { $(this).css({background: '#FFF'}); }
 
  97         $('.show-all-tags').click(function() {
 
  98             $(this).parent().parent().fadeOut(function() { 
 
  99                 $(this).next().fadeIn();
 
 104         $('.hide-all-tags').click(function() {
 
 105            $(this).parent().parent().fadeOut(function() {
 
 106                $(this).prev().fadeIn();
 
 111         $('#registration-form').ajaxForm({
 
 113             beforeSubmit: function() {
 
 114                 $('#registration-form input[type=submit]')
 
 115                     .attr('disabled', 'disabled')
 
 116                     .after('<img src="/static/img/indicator.gif" style="margin-left: 0.5em"/>');
 
 118             success: function(response) {
 
 119                 if (response.success) {
 
 120                     location.reload(true);
 
 122                     $('#registration-form span.error').remove();
 
 123                     $.each(response.errors, function(id, errors) {
 
 124                         $('#id_registration-' + id).before('<span class="error">' + errors[0] + '</span>');
 
 126                     $('#registration-form input[type=submit]').removeAttr('disabled');
 
 127                     $('#registration-form img').remove();
 
 132         $('#login-form').ajaxForm({
 
 134             beforeSubmit: function() {
 
 135                 $('#login-form input[type=submit]')
 
 136                     .attr('disabled', 'disabled')
 
 137                     .after('<img src="/static/img/indicator.gif" style="margin-left: 0.5em"/>');
 
 139             success: function(response) {
 
 140                 if (response.success) {
 
 141                     location.reload(true);
 
 143                     $('#login-form span.error').remove();
 
 144                     $.each(response.errors, function(id, errors) {
 
 145                         $('#id_login-' + id).before('<span class="error">' + errors[0] + '</span>');
 
 147                     $('#login-form input[type=submit]').removeAttr('disabled');
 
 148                     $('#login-form img').remove();
 
 153         $('#login-register-window').jqm({
 
 156             trigger: '.login-register-link',
 
 157             onShow: function(hash) {
 
 158                 var offset = $(hash.t).offset();
 
 159                 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
 
 160                 $('div.header', hash.w).css({width: $(hash.t).width()});
 
 165         $('ul.shelf-list li').hover(function() {
 
 166             $(this).css({background: '#EEE', cursor: 'pointer'});
 
 168             $(this).css({background: 'transparent'});
 
 169         }).click(function() {
 
 170             location.href = $('a.visit-shelf', this).attr('href');
 
 173         $('.delete-shelf').click(function() { 
 
 175             var shelf_name = $('.visit-shelf', link.parent()).text();
 
 176             if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
 
 177                 $.post(link.attr('href'), function(data, textStatus) {
 
 178                     link.parent().remove();
 
 184         $('#user-shelves-window').jqm({
 
 186             target: $('#user-shelves-window div.target')[0],
 
 188             trigger: '#user-shelves-link',
 
 189             onShow: function(hash) {
 
 190                 var offset = $(hash.t).offset();
 
 191                 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
 
 192                 $('div.header', hash.w).css({width: $(hash.t).width()});
 
 195             onLoad: function(hash) { 
 
 196                 $('form', hash.w).ajaxForm({
 
 197                     target: $('#user-shelves-window div.target'),
 
 198                     success: function() { setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000) }
 
 201                 $('input', hash.w).labelify({labelledClass: 'blur'});
 
 203                 $('ul.shelf-list li', hash.w).hover(function() {
 
 204                     $(this).css({background: '#EEE', cursor: 'pointer'});
 
 206                     $(this).css({background: 'transparent'});
 
 207                 }).click(function() {
 
 208                     location.href = $('a.visit-shelf', this).attr('href');
 
 211                 $('.delete-shelf').click(function() {
 
 213                     var shelf_name = $('.visit-shelf', link.parent()).text();
 
 214                     if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
 
 215                         $.post(link.attr('href'), function(data, textStatus) {
 
 216                             link.parent().remove();
 
 224         $('#books-list .book').hover(
 
 225             function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
 
 226             function() { $(this).css({background: '#FFF'}); }
 
 228             location.href = $('h2 a', this).attr('href');
 
 231         $('#toggle-description').hover(
 
 232             function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
 
 233             function() { $(this).css({background: '#EEE'}); }
 
 235             if ($('#description').hasClass('hidden')) {
 
 236                 $('#description').slideDown('fast').removeClass('hidden');
 
 237                 $.cookie('description-state', 'opened', {path: '/', expires: 30});
 
 238                 $('p', this).html('Zwiń opis ▲');
 
 240                 $('#description').slideUp('fast').addClass('hidden');
 
 241                 $.cookie('description-state', 'closed', {path: '/', expires: 30});
 
 242                 $('p', this).html('Rozwiń opis ▼');
 
 246         var target = $('#set-window div.target');
 
 248         $('#set-window').jqm({
 
 252             trigger: 'a.jqm-trigger', 
 
 253             onShow: function(hash) { 
 
 254                 var offset = $(hash.t).offset();
 
 255                 target.html('<p><img src="/static/img/indicator.gif" /> Ładowanie</p>');
 
 256                 hash.w.css({position: 'absolute', left: offset.left, top: offset.top}).show() },
 
 257             onLoad: function(hash) { 
 
 258                 $('form', hash.w).ajaxForm({
 
 260                     success: function() { setTimeout(function() { $('#set-window').jqmHide() }, 1000) }
 
 265         $('a.remove-from-shelf').click(function(event) {
 
 266             event.preventDefault();
 
 268             $.post(link.attr('href'), function(data, textStatus) {
 
 269                 link.parent().remove();
 
 273         if ($.cookie('description-state') == 'closed') {
 
 274             $('#description').hide().addClass('hidden');
 
 275             $('#toggle-description p').html('Rozwiń opis ▼');
 
 278         $('#user-info').show();
 
 280         $('#onepercent-banner').show();
 
 282         var formatsDownloaded = false;
 
 283         $('#download-shelf').click(function() {
 
 284             $('#download-shelf-menu').slideDown('fast');
 
 286             if (!formatsDownloaded) {
 
 287                 // Pobierz dane o formatach
 
 288                 formatsDownloaded = true;
 
 290                     url: $('#download-formats-form').attr('data-formats-feed'),
 
 293                     complete: function() {
 
 294                         $('#download-formats-form-submit').attr('disabled', null);
 
 295                         $('#download-formats-form-submit-li img').remove();
 
 296                         $('#updating-formats').fadeOut('fast', function() {
 
 297                             $('#formats-updated').fadeIn('fast');
 
 300                     success: function(data) {
 
 301                         $('#download-formats-form li').each(function() {
 
 303                             if (!!item.attr('data-format') && !data[item.attr('data-format')]) {
 
 304                                 item.fadeOut('fast', function() {
 
 315         $('#download-formats-form-cancel').click(function() {
 
 316             $('#download-shelf-menu').slideUp('fast');