[eluser]rideearthtom[/eluser]
[quote author="TheJim" date="1271409310"]Well, that's what I get for writing a rushed reply.[/quote]
Don't get the impression I'm not grateful - thanks to your (rushed?) reply I cut 4 queries to 2 and removed half the lines of code from the function! Just wanted to clarify the points above and include corrections for the benefit of other people who may find it useful.