I'm kind of surprised that either of them works, because you're giving setTimeout a string that defines a function without calling it; if you give setTimeout a string, it essentially does an eval on the string when the timeout occurs, which in theory would create but not call the function. (Edit: And I've confirmed that: http://jsbin.com/uvuje5)
It's almost never correct or necessary to give setTimeout a string; instead, give it a function:
function view_mail_popup_close()
{
setTimeout(function () { $('#popupbox').fadeOut('slow'); },200);
setTimeout(function () { window.location='view_mail.php'; },800);
}
Live example
There, the function is created immediately and the reference to it is given to setTimeout, which will call it when the timeout occurs.
(Off-topic: I've also added a missing semicolon at the end of the window.location = statemenet. JavaScript has semicolon insertion, and so the previous version would work, but I strongly advocate never relying on it.)
Update: As Capsule points out, there's a callback on fadeOut that you probably want to use instead of a second setTimeout:
function view_mail_popup_close()
{
setTimeout(function () {
$('#popupbox').fadeOut('slow', function() {
window.location='view_mail.php';
});
}, 200);
}
Live example