added some extra smarts to the fixed sidebar

Added in a check for the window height before applying fixed positioning to the sidebar. This is to solve a problem where currently if you are browsing on a small screen (or in some cases even a large screen) the bottom of the sidebar gets cut off and made inaccessible.