Yes it helps... kinda. The trouble is I still faill to understand how that particular JS works, so I cannot emulate it in perl :(.
For info, there is a module called Javascript that enables you to execute embedded js code in a perl script.
I'm going to dissect the JS i'm working on before asking more questions, i'll keep you posted.