states demo: 

not sure where onstatechange is coming from, probably some really old code that should actually go away?