Ported from jQuery to YUI