Working open and close popup, insert content in the popup