A Finite State Machine that Depends on jQuery