Simple flow-control functions for javascript