title: Casperjs: "TypeError: 'undefined' is not a function" if evaluate() is used in another file
body: <p>the following code ist working with casperjs 1.1.0-beta3 and phantomjs 1.9.8:</p>
  
  <pre><code>function getImage(locator, casper) {
  
  return casper.evaluate(function(locator) {
      return Array.prototype.map.call(document.querySelectorAll(locator), function(e) {
          return e.getAttribute('src');
      });
  },locator);
  
  };    
  
  casper.start("http://stackoverflow.com/", function () {
  
      var img = getImage('img[class="sponsor-tag-img"]', this);
      this.echo(img[0]);
      this.download(img[0], "logo.png");   
  
  });
  
  casper.run();
  </code></pre>
  
  <p>But if I split up the code into two files and call util.getImage() from the other file, the following error appears: <code>~/tmp/PhantomCSS $ casperjs test --web-security=no demo/stack.js</code> </p>
  
  <pre><code>FAIL TypeError: 'undefined' is not a function (evaluating 'util.getImage('img[class="sponsor-tag-img"]', this)')
  #    type: uncaughtError
  #    file: demo/stack.js:5
  #    error: 'undefined' is not a function (evaluating 'util.getImage('img[class="sponsor-tag-img"]', this)')
  #           TypeError: 'undefined' is not a function (evaluating 'util.getImage('img[class="sponsor-tag-img"]', this)')
  #               at demo/stack.js:5
  #               at runStep (/usr/local/lib/node_modules/casperjs/modules/casper.js:1553)
  #               at checkStep (/usr/local/lib/node_modules/casperjs/modules/casper.js:399)
  #    stack: not provided
  </code></pre>
  
  <p>stack.js:</p>
  
  <pre><code>var util = require('/home/gauss/tmp/PhantomCSS/demo/util.js');
  
  casper.start("http://stackoverflow.com/", function () {
  
      var img = util.getImage('img[class="sponsor-tag-img"]', this);
      this.echo(img[0]);
      this.download(img[0], "logo.png");   
  
  });
  
  casper.run();
  </code></pre>
  
  <p>util.js:</p>
  
  <pre><code>function getImage(locator, casper) {
  
      return casper.evaluate(function(locator) {
          return Array.prototype.map.call(document.querySelectorAll(locator), function(e) {
              return e.getAttribute('src');
          });
      },locator);
  
  };
  </code></pre>
  
  <p>How to fix it?</p>