take popup funtion outside application.js