Code like this always scares me a little, because you have multiple possible `null`/`undefined` errors here.  Is it possible that `overlay.childNodes` will be empty?  This might be OK, but code like this has a bad smell.