escape javascript properly.

code from Smarty's modifier.escape.php
tests for javascript escapes.

silly examples provided by kalle volkov :)