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:

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.