Yes, and I understand that you want this to be a function - but I don't understand what is IN your function, and what your call to the function looks like, and what exactly doesn't work when you use the function. That is the code I want posted - because that's the code you want to have working.
But I think it will have to wait for later, as I'm off to bed now.
--
Mats