             }
             
             // Only adjust for local bounds if the element is taller than the scroll height
-            if (elementR.height > scrollR.height)
+            if (elementR.height > scrollR.height || !entireElementVisible)
             {
                 if (elementLocalBounds.bottom > scrollR.bottom) 
                     dy = elementLocalBounds.bottom - scrollR.bottom;

     *  For the offset properties, a value of NaN means don't offset from that edge. A value
     *  of 0 means to put the element flush against that edge.
     * 
     *  @param topOffset Number of pixels to position the element below the top edge.
     *  @param bottomOffset Number of pixels to position the element above the bottom edge.
     *  @param leftOffset Number of pixels to position the element to the right of the left edge.

            (scrollR.containsRect(elementR) || (!elementLocalBounds && elementR.containsRect(scrollR))))
            return null;
        
        var dx:Number = 0;
        var dy:Number = 0;
        
        if (entireElementVisible)
        {
            var dxl:Number = elementR.left - scrollR.left;     // left justify element
            var dxr:Number = elementR.right - scrollR.right;   // right justify element
            var dyt:Number = elementR.top - scrollR.top;       // top justify element
            var dyb:Number = elementR.bottom - scrollR.bottom; // bottom justify element
            
            // minimize the scroll
            dx = (Math.abs(dxl) < Math.abs(dxr)) ? dxl : dxr;
            dy = (Math.abs(dyt) < Math.abs(dyb)) ? dyt : dyb;
            
            if (!isNaN(topOffset))
                dy = dyt + topOffset;
            else if (!isNaN(bottomOffset))
                dy = dyb - bottomOffset;
            
            if (!isNaN(leftOffset))
                dx = dxl + leftOffset;
            else if (!isNaN(rightOffset))
                dx = dxr - rightOffset;
            
            // scrollR "contains"  elementR in just one dimension
            if ((elementR.left >= scrollR.left) && (elementR.right <= scrollR.right))
                dx = 0;
            else if ((elementR.bottom <= scrollR.bottom) && (elementR.top >= scrollR.top))
                dy = 0;
            
            // elementR "contains" scrollR in just one dimension
            if ((elementR.left <= scrollR.left) && (elementR.right >= scrollR.right))
                dx = 0;
            else if ((elementR.bottom >= scrollR.bottom) && (elementR.top <= scrollR.top))
                dy = 0;
        }
        
        if (elementLocalBounds)
        {
            // Only adjust for local bounds if the element is wider than the scroll width
            if (elementR.width > scrollR.width || !entireElementVisible)
            {
                if (elementLocalBounds.left < scrollR.left)
                    dx = elementLocalBounds.left - scrollR.left;
