javascript selection fn to zencoding