In the first code you can see.
document.title=""+title+"";
I took that out in the second code. What it does is instead of making it the title of the whole page AND the title of the first box, it only makes it the title of the new box. If that makes sense