actually when I come to think of it... the onunload event fires after the unload so you might wanna look for another event
<script type="text/javascript">
function MsgOkCancel()
{
var fRet;
fRet = confirm('Are you sure?');
if (fRet==true)
{
//fire unload event here.
}
}
</script>
but just consider these bumps... can't remember which event that fires before onunload.