Add idle state as javascript timeout function