Change max-height function to take into consideration any padding applied to the DIV container

Scrollbar is not rendered correctly when padding is present on the container DIV element and using only the max-height property. Added code to calculate the scrollbar height taking into consideration any applied padding.