Fixed javascript so the open/close button works correctly