How can I define a global function which would be accessible from any page?
Put it in an include, and then include it.