I wonder why this is the latest trend in scripting.... Everyone seems to forget the distinction between JavaScript ( Clinet side language ) and PHP ( Server side language ).

In my opinion, when you have to "convert" code to JavaScript from PHP, it is :

1) Bad planning and design
2) Completely and utterly unecessary
3) Senseless.

Make your PHP code as such, that JavaScript an access objects from it as well - a common way of doing this is through the URL string manipulation and hidden HTML Form fileds.