
    $(document).ready(function() {
 
  //this is the floating content
  var $floatingbox = $('#shareBox, .scrollingBox');
 
  if($('#interiorContentWrapper').length > 0){
 
    var bodyY = parseInt($('#shareBox, .scrollingBox').offset().top) - 20;
    var originalX = $floatingbox.css('margin-left');
 
    $(window).scroll(function () { 
 
     var scrollY = $(window).scrollTop();
     var isfixed = $floatingbox.css('position') == 'fixed';
 
     if($floatingbox.length > 0){
 
        //$floatingbox.html("srollY : " + scrollY + ", bodyY : " + bodyY + ", isfixed : " + isfixed);
 
        if ( scrollY > bodyY && !isfixed ) {
      $floatingbox.stop().css({
        position: 'fixed',
        left: '50%',
        top: 20,
        marginLeft: -560
      });
    } else if ( scrollY < bodyY && isfixed ) {
         $floatingbox.css({
        position: 'relative',
        left: 0,
        top: 20,
        marginLeft: originalX
    });
       }    
     }
       });
     }
    });
    
    
     
