add javascript for overlay function