Did you change every instance of the popup function ? Put so alerts into the JS and see it you are calling the correct instance of the popup function.