added a counter and a setTimeout that will call setDefaultWindowSize up to 10 times (50ms apart) so as to collect accurate dimensions for the pop-up window.