Please stop pasting huge chunks of code on the forums. Use something like http://pastebin.ca/.
That code runs fine for me. What problem are you having?
It might be simplest to start off with the original plugin and fix that because you might have done quite a lot to it.