(function ($) {
  Drupal.behaviors.slidebox = {
    attach: function(context, settings) {
      $(window).scroll(function() {
        var distanceTop = $('#slidebox_trigger').offset().top - $(window).height();

        if  ($(window).scrollTop() > distanceTop) {
          $('#slidebox').animate({'right':'0px'}, settings.slidebox.showTime);
          $('#slidebox_manual').hide();
        }
        else {
          $('#slidebox').stop(true).animate({'right': '-' + ($('#slidebox').width() + 30) + 'px'}, settings.slidebox.hideTime);
          $('#slidebox_manual').show();
        }
      });

      $('#slidebox .close').click(function(){
        $('#slidebox').stop(true).animate({'right': '-' + ($('#slidebox').width() + 30) + 'px'}, settings.slidebox.hideTime);
        $('#slidebox_manual').show();
      });

      $('#slidebox_manual .open').click(function() {
        $('#slidebox').animate({'right':'0px'}, settings.slidebox.showTime);
        $('#slidebox_manual').hide();
      });
    }
  };
})(jQuery);

;
(function ($) {

  Drupal.behaviors.addthis = {
    attach: function(context, settings) {
      $.getScript(
        Drupal.settings.addthis.widget_url,
        function(data, textStatus) {
          addthis.init();
        }
      );
      if (context != window.document && window.addthis != null) {
        window.addthis.ost = 0;
        window.addthis.ready();
      }
    }
  };

}(jQuery));
;

