Please can you post your whole program and put it in code tags (# above the smileys)
The problem may not actually be in your function at all but without seeing all of your code it is impossible to help.
Please can you post your whole program and put it in code tags (# above the smileys)
The problem may not actually be in your function at all but without seeing all of your code it is impossible to help.