I have to admit at the facts that the functions are really the same,but well when i replied i was sure i wrote that function(to be honest i'm still sure).Comparing the code it seems you are right,but well actually that's no important because in both of the cases i don't see the difference:copying the function or your code and put it in a function for me is the same thing.That's why i didn't understand why you had to continue.However to talk about the script someone could be find interest
that page ..Well i really think the author just copied all stuff.