var footerAnimating = false;
var footerHover = false;

function showFooter() {
  footerAnimating = true;
  new Effect.Opacity('footer', { to:1, duration:0.15, afterFinish:function(){
      footerAnimating = false;
  }});
}

function hideFooter() {
  footerAnimating = true;
  new Effect.Opacity('footer', { to:0.01, duration:0.25, afterFinish:function(){
      footerAnimating = false;
  }});
}

setInterval(function(){                        
  if (! footerAnimating) {
      if (! footerHover && $('footer').getOpacity() == 1) {
          hideFooter();
      } else if (footerHover && $('footer').getOpacity() == 0.01) { 
          showFooter();
      }
  }
  
  if (
      document.viewport.getScrollOffsets().top >= 1500 &&
      $('return_to_top').getOpacity() == 0
  ) {
      new Effect.Opacity('return_to_top', { to:1, duration:0.50 });                        
  } else if ( 
      document.viewport.getScrollOffsets().top < 1500 &&
      $('return_to_top').getOpacity() == 1
  ) {
      new Effect.Opacity('return_to_top', { to:0, duration:0.50 });                        
  }
}, 200);

var next_page = $('next_page_link') ? $('next_page_link').href : false;
var loading_next_page = false;

new PeriodicalExecuter(auto_paginator, 0.2);
        