Hi,
I have my code working fine here:http://jsfiddle.net/vaSg5/

But I can't seem to make it work on my page.

Here is my code:
http://pastie.org/1319274

I think I am missing a fundemental understanding of how to call this function, so any suggestions as to changes or reading material, would be greatly appreciated.
Thanks, Adrian.