I don't really know Javascript. Gardener wrote that bit. The javascript in showflat assigns the post number when you click "Quick Reply". But it's not needed in threaded. You could probably safely take that out.
I've installed this on no less than 50 sites for sure, nobody's ever had an error. <shrug>
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.