useful generic javascripts