Added javascript for switching to popup