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.
subject: popup to confirm delete doesn't work on all situations