+ $('#onepercent-banner').show();
+
+ var formatsDownloaded = false;
+ $('#download-shelf').click(function() {
+ $('#download-shelf-menu').slideDown('fast');
+
+ if (!formatsDownloaded) {
+ // Get info about the formats
+ formatsDownloaded = true;
+ $.ajax({
+ url: $('#download-formats-form').attr('data-formats-feed'),
+ type: 'GET',
+ dataType: 'json',
+ complete: function() {
+ $('#download-formats-form-submit').attr('disabled', null);
+ $('#download-formats-form-submit-li img').remove();
+ $('#updating-formats').fadeOut('fast', function() {
+ $('#formats-updated').fadeIn('fast');
+ });
+ },
+ success: function(data) {
+ $('#download-formats-form li').each(function() {
+ var item = $(this);
+ if (!!item.attr('data-format') && !data[item.attr('data-format')]) {
+ item.fadeOut('fast', function() {
+ item.remove();
+ });
+ }
+ });
+ }
+ });
+ }
+ return false;
+ });
+
+ $('#download-formats-form-cancel').click(function() {
+ $('#download-shelf-menu').slideUp('fast');
+ return false;
+ });
+
+ $('.sponsor-logos').cycle({timeout: 3000});
+
+ $('.widget-code').focus(
+ function(){
+ $(this).animate({rows: '11'}, 100, function(){
+ this.select();
+ $(this).click(function(){
+ this.select();
+ });
+ })
+
+ }
+ ).blur(
+ function(){
+ $(this).animate({rows: '1'}, 300, function(){
+ $(this).unbind('click');
+ })
+ }
+ );
+
+ $('.book-list-index').click(function(){
+ $('.book-list-show-index').hide('slow');
+ if($(this).parent().next('ul:not(:hidden)').length == 0){
+ $(this).parent().next('ul').toggle('slow');
+ }
+ return false;
+ });
+
+ // player for audiobooks
+
+ // event handlers for playing different formats
+ $('.audiotabs span').click(function(){
+ $('.audiobook-list').hide();
+ $('.audiotabs .active').removeClass('active');
+ // we don't want to interact with "audiobook" label, just 'format' tabs
+ var $this = $(this);
+ $this.addClass("active");
+ $("#"+$this.attr('data-format')+"-files").show();
+ });
+
+ $('.audiobook-list').hide();
+ $("#"+$(".audiotabs .active").html().toLowerCase()+"-files").show();
+
+ /* this will be useful for javascript html player
+ var medias = $('.audiobook-list a');
+ var mp3List = [];
+ var oggList = [];
+ var daisyList = [];
+ var tmpExt;
+ if (medias.length > 0) {
+ // creating sources list for player
+ medias.each(function(index, item) {
+ tmpExt = item.href.split(".").pop();
+ if(tmpExt == "mp3") {
+ mp3List.push(item.href);
+ } else if (tmpExt == "ogg") {
+ oggList.push(item.href);
+ } else if(tmpExt == "daisy") {
+ daisyList.push(item.href);
+ }
+ });
+ }*/
+