 Cookies           = require("./cookies")
 { EventEmitter }  = require("events")
 EventLoop         = require("./eventloop")
+FS                = require("fs")
 History           = require("./history")
 Interact          = require("./interact")
 JSDom             = require("jsdom")
+PATH              = require("path")
 Resources         = require("./resources")
 Storages          = require("./storage")
 URL               = require("url")
 XHR               = require("./xhr")
 WebSocket         = require("./websocket")
 
+FILE_CLASS = ->
 
 HTML = JSDom.dom.level3.html
 MOUSE_EVENT_NAMES = ["mousedown", "mousemove", "mouseup"]

  attach: (selector, filename, callback)->
    field = @field(selector)
    if field && field.tagName == "INPUT" && field.type == "file"
      field.value = filename
      @fire "change", field, callback
      unless callback
        return this
    else

    @_ws.extend newWindow
    newWindow.screen = new Screen()
    newWindow.JSON = JSON
    newWindow.File = FILE_CLASS
    newWindow.Image = (width, height)->
      img = new HTML.HTMLImageElement(newWindow.document)
      img.width = width
