'document.observe' and a variable generated in controller

I have a java script function which I want to call once the page has

Initially it looked like this:

I was then advised by people on this forum that it is good practice to
put this into an external js file thus:

document.observe(‘dom:loaded’, function() {

That also worked fine.

Now, I want to pass a variable to this function which is generated in my
application’s controller (@member)

If I do this in my view, everything works fine:

Yet if I do this in the js file, then nothing works (as might be

document.observe(‘dom:loaded’, function() {

Is there any way to use ‘document.observe’ in an external js file with a
variable generated in my ruby controller?
If not, what is the best practice in this case?

Thanks in advance