Added replay javascript function