Fixed multiple panel JS to only run when required