Check for the mousedown on the body not the document. This prevents the calendar from closing when you use the scrollbars in Chrome or Firefox.