nice bit of coding
only thing I would say is it is genrally a good idea to try to keep maths equations outside of loops such as this cos they can really hit the speed of the pages. Great equation though
Haven't tried it but read the code but it looks like it would work very well indeed.