working js mainpage