updated js to address show/hide bug