It works cos I have tested it. Replace all your header include with this code.
<script type="text/javascript">
<!--
//Show the pm in a pop up way
if (confirm("You have {$mybb->user['pms_unread']} unread private messages.\n\nFrom: {$pm['fromusername']}\nTitle: {$pm['subject']}"))
{
// Output when OK is clicked
if (confirm("Open message in a new window?"))
{
var winobj = window.open("{$mybb->settings['bburl']}/private.php?action=read&pmid={$pm['pmid']}", "pmnew", "statusbar=yes,menubar=yes,scrollbars=yes,toolbar=yes,location=yes,directories=ye s,resizable=yes,top=50,left=50");
if (winobj == null)
{
if(confirm("Could not open a new window. Open PM in current window instead?"))
{
window.location = "{$mybb->settings['bburl']}/private.php?action=read&pmid={$pm['pmid']}";
}
}
}
else
{
window.location = "{$mybb->settings['bburl']}/private.php?action=read&pmid={$pm['pmid']}";
}
}
new Ajax.Request('private.php?action=dismiss_notice', {method: 'post', postBody: 'ajax=1&my_post_key='+my_post_key});
//-->
</script>
<link rel="alternate" type="application/rss+xml" title="{$lang->latest_threads} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_threads} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?type=atom1.0" />
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/prototype.js?ver=1400"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/general.js?ver=1400"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/popup_menu.js?ver=1400"></script>
{$stylesheets}<link type="text/css" rel="stylesheet" href="{$mybb->settings['bburl']}/css/regbar.css" />
<script type="text/javascript">
<!--
var cookieDomain = "{$mybb->settings['cookiedomain']}";
var cookiePath = "{$mybb->settings['cookiepath']}";
var cookiePrefix = "{$mybb->settings['cookieprefix']}";
var deleteevent_confirm = "{$lang->deleteevent_confirm}";
var removeattach_confirm = "{$lang->removeattach_confirm}";
var loading_text = '{$lang->ajax_loading}';
var saving_changes = '{$lang->saving_changes}';
var use_xmlhttprequest = "{$mybb->settings['use_xmlhttprequest']}";
var my_post_key = "{$mybb->post_code}";
var imagepath = "{$theme['imgdir']}";
// -->
</script>
<script type="text/javascript">
<!--
//Show the pm in a pop up way
if (confirm("You have {$mybb->user['pms_unread']} unread private
messages.\n\nFrom: {$pm['fromusername']}\nTitle: {$pm['subject']}"))
{
// Output when OK is clicked
if (confirm("Open message in a new window?"))
{
var winobj =
window.open("{$mybb->settings['bburl']}/private.php?action=read&pmid={$pm['pmid']}",
"pmnew",
"statusbar=yes,menubar=yes,scrollbars=yes,toolbar=yes,location=yes,directories=ye
s,resizable=yes,top=50,left=50");
if (winobj == null)
{
if(confirm("Could not open a new window. Open PM in current window instead?"))
{
window.location = "{$mybb->settings['bburl']}/private.php?action=read&pmid={$pm['pmid']}";
}
}
}
else
{
window.location = "{$mybb->settings['bburl']}/private.php?action=read&pmid={$pm['pmid']}";
}
}
new Ajax.Request('private.php?action=dismiss_notice', {method: 'post', postBody: 'ajax=1&my_post_key='+my_post_key});
//-->
</script>
<script type="text/javascript" src="jscripts/thx.js?ver=1400"></script>
{$newpmmsg}
<script type="text/javascript">
function selectCode(a)
{
var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
if (window.getSelection)
{
var s = window.getSelection();
if (s.setBaseAndExtent)
{
s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
}
else
{
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
}
else if (document.getSelection)
{
var s = document.getSelection();
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
else if (document.selection)
{
var r = document.body.createTextRange();
r.moveToElementText(e);
r.select();
}
}
</script>