If you want to view the code,
here is the include file
and
here is the primary algorithm.

If you copy it, please cite Tim Harker - thanks.

If you want to contact me,it's
junk at timharker dot com
- nothing personal ;-)