Well, for one, its not complete code. There is just one function defined and then a couple lines of code outside that function. Throughout it references variables that are not defined by the script (if that is the whole script) and document.onKlick is undefined. Unless you have other code that is supposed to work with this code, you should definitely pull it out.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: popup to confirm delete doesn't work on all situations