I\'m not sure what is wrong with my code, but when I try and add actorWin.document.write(\'
If your embedding javascript in an HTML page the HTML parser when it finds your first script tag will immediately try to find the closing tag. Since your closing script tag is in your document.write you'll find yourself in a pickle.
You can easily just escape the closing forward slash on the tag with a backslash:
document.write("')
To:
document.write("