Rewritten to use YUI3, rather than jQuery