Here's a little code I'm just gonna throw out there. If you want to use your PHP variables as javascript variables, just do this:
<?
print "<script>
varname=".$varname."
</script>";
?>
You people probably already knew that though. I'll go now and stop wasting your time. :o