Error 500 -- internal server error -- has nothing to do with your Javascript. The error is happening on the server, and the server doesn't try to execute your Javascript. Chances are the problem is that there's a field on the form whose Value formula (if computed) or Default or keyword formula (if editable) is producing an error result.
http://www-1.ibm.com/support/docview.wss?rs=899&uid=sim2407c49349e4bd4fb85256cc300008cdc gives another possible explanation.