Here is what you can try
OpenWindow.document.write(output);
call OpenWindow.init()
when the dom is ready So the parent window will have
OpenWindow.onload = function(){
OpenWindow.init('test');
}
and in the child
function init(txt){
$('#test').text(txt);
}