Amazing this has UDF has not existed before now.

I do see it has been discussed some 4 years ago with Jens coming up with a different solution.

http://www.kixtart.org/forums/ubbthreads...true#Post112135