First pass at JS functionality for popup