That Javascript code Clark is referring should work fine (syntax is right, anyway). That's just another way to both define and execute a function "on the fly."
Also, the error message I got was this:
Parse error: parse error, unexpected '{' in ... on line 105
Here's line 105:
if (!is_file(dirname(__FILE__).'/captcha.ttf') {
Notice that you're missing a final ')' to close the if() statement.
EDIT: Woops - guess that's not you're only error. You also have a missing semicolon on line 236.