Js-statemachine is a project mainly written in JavaScript, it's free.
A little state machine library for JavaScript. Neat!