For more information, see Bruce Axten's post or the discussion in comp.lang.javascript. You can also see my alternative version.