working js for dias panel