Kick-ass finite state machines with jQuery