Moved login popup code into own JS file