I saw an interesting question on StackOverflow on how to cycle between 3 states for list items , but with initial state for each item being potentially different.
This random start position part of the problem was making me think, so I used it as an exercise to try some newish jQuery functions, such as delegate and advanced class selectors.
My solution was basically to build a reduced case of state transition diagram with a cycle. The advantage of it is that any number of states can be iterated through. It could even be a plugin, if need be.
My full test example can be found in the original SO question, probably toward the bottom. I am also including it here as a Pastie: