         return
 
 
+    getFluidChildren = ($elem, options) ->
+        $elem.children().filter(options.fluid)
+
+
     getStackedHeights = ($elem, options) ->
         remainingHeight = options.maxHeight
 
         $children = $elem.children()
-        $fluidChildren = $children.filter(options.fluid)
+        $fluidChildren = getFluidChildren($elem, options)
 
         heights = []
 


        stackedClass: 'stacked'

        # Overlay class name
        overlayBeforeClass: 'overlay-before'
        overlayAfterClass: 'overlay-after'

        # Overlay class for the parent for the first and last elements
        overlayFirstClass: 'overlay-first'
        overlayLastClass: 'overlay-last'




    applyStackedHeights = ($elem, heights, options) ->
        # Set the explicit height of the element
        $elem.height((height = options.maxHeight))

        top = 0
        bottom = height
        reverse = false

        $elem.children().each (i, child) ->
            $child = $(child)
            config = heights[i]

            bottom -= config.height

            # The bottom position is set for fluid elements
            if config.fluid
                reverse = true
                css =
                    top: top
                    bottom: bottom
            else if reverse
                css = bottom: bottom
            else
                css = top: top

            $child.css(css)

