rewrite popup window