So I have written quite a nice little piece of ruby code to automate
the transfer of information from one web page to (a series of) web
(pages).

This is an ordering system where for speed, all pertentent information
is placed one one page.  then later another person makes the order
from this page...  either way.

How can I access a piece of javascript code like the following

  function addBilling(str) {
    var url;
    if (str == "shipping") {
      url = "/BSSONLINE/order/billingAddress.jsp?pagename=shipping&sashnbr="
+ escape("934873") + "&sanick=" +escape("REPLACEMENT  
9200293040870")+"&salname="+escape("REPLACEMENT                   ");
    }

    else if (str == "billing") {
      url = "more of the same like above";
    }

    location.replace(url);
  }

I have tried thnigs like the following:
@ieto.document.main.addBilling("shipping")
but to no avail.  any help would be great.  

thanks.