Are you sure? You have more than one new PM, and yet it only acts as if there's one? Keep in mind that if you have 2 new PMs and get a popup, and then send yourself another, the popup will only "see" one. That's the way the system works.
Daniel: that looks like it should work. Does your <body> tag on that same page at the same time have an onload="" attribute calling the confirm_newpm() function?
squawell: as Lionel said, please replace your head_newpm template with the one now listed in the first post of this thread.