popup page, common script for popup and background pages