The best to do is to remove the changed ehlpdhtm.js and start anew. The functions I pointed to earlier are the ones you need. Short of changing it for you and debugging myself, there's not much I can do.
If you like, I offer consultancy for these kinds of issues. Please contact me at contact [at] wvanweelden.eu.
Kind regards,
Willam