Refactor Overlay/Flyout clickeating div code