Use and/or adapt as you see fit. I'd be interested in any bugs found or improvements anyone might make.
Code might look ugly but it seems to work
Hope it might be useful to someone
sims
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller