I'm so sorry. It took me forever and I still couldn't figure it out. So I looked at the source for the page and reverse-engineered the Javascript.
I'd suggest translating this to PHP and using AJAX to hide the algorithm so other people can't do the same thing.
I feel bad; if I had given it another half-hour I probably would have figured it out. lol