popup window positioning optimized