Can't get snippet to run on page load

Hi Rob, This works fine for a page. But when i use this page as a popup in another, its not working. Can u please suggest a solution for it? Thanks!