Added JS functions for controlling grid visibility