How to pass a variable to Javascript a Control Application

It seems next to impossible to pass a global variable into the Controls Javascript .
I have a global variable agentID, how for the lifewhich is passed to my control app (sample1). I need to use agentID in the JavaScript.

Please how for the life of me is this possible?

you can do jsvar = <?php.echo [global_sc_var]; ?>;

Thanks Frank got it