you can’t. (unless we’re talking not about Smarty, the PHP templating engine)
PHP finished working before JavaScript starts up. The only way JS can interact with PHP is through a HTTP Request. however, you can use PHP (and Smarty) to print out JS code.
__________________
please post your code wrapped in [CODE] [/CODE] tags