javascript function needs rails variable

<script type="text/javascript">

    document.getElementById('h').checked=true;
    show_coords(<%= @pic_comments.to_json %>,"main",'<%=$domain%>/
users/update_picture_div',<%= @picture.id %>)

</script>
I have implement this but rails variables are not working.

This will only work if that script block is in an .erb template.

it starts working
Cheers
Rabia Akhtar