text: function InputBoxModule(window, document) {
  
  var Font = "Cousine"
  var HeaderHeight = 30
  var Padding = 2
  var DarkBackground = "#455A64"
  var BorderRadius = "3px"
  var NormalBack = "linear-gradient(#758A94, #455A64)"
  var SpecialBack = "linear-gradient(coral, #CD5B45)"
  var globs = {}
  
  // Autogenerated with DRAKON Editor 1.32
  
  
  function buildWindow(headerText, oldText) {
      // item 23
      var main = HtmlUtils.createPopup(null, true)
      main.className = "popup"
      main.style.background = "white"
      // item 177
      if (HtmlUtils.isMobile()) {
          // item 181
          main.style.minWidth = "200px"
          main.style.width = "100%"
      } else {
          // item 180
          main.style.minWidth = "200px"
          main.style.width = "500px"
      }
      // item 144
      HtmlUtils.makePopupModal()
      // item 26
      //HtmlUtils.noContext(main)
      // item 198
      var winTitle = makeWindowTitle(
      	main,
      	headerText
      )
      // item 199
      var img = winTitle.cross
      // item 30
      img.onclick = hide
      // item 29
      var client = make(main, "div")
      // item 67
      var error = make(main, "div")
      globs.error = error
      error.style.background = "yellow"
      error.style.padding = "3px"
      // item 68
      error.style.display = "none"
      // item 69
      var editor = make(main, "textarea")
      globs.editor = editor
      // item 70
      editor.style.fontSize = "14px"
      editor.style.fontFamily = Config.EDITOR_FONT
      editor.className = "mousetrap"
      // item 71
      editor.style.boxSizing = "border-box"
      editor.style.resize = "none"
      editor.style.outline = "none"
      editor.style.width = "100%"
      editor.style.padding = "10px"
      editor.style.border = "none"
      editor.style.height = "180px"
      editor.style.margin = "0px"
      editor.style.borderBottom = "solid 1px #707070"
      editor.style.verticalAlign = "top"
      // item 124
      editor.value = oldText
      // item 176
      editor.spellcheck = false
      // item 121
      editor.onfocus = fixIPadKeyboard
      // item 175
      editor.onkeydown = handleTab
      // item 72
      var panel = make(main, "div")
      panel.style.height = "40px"
      // item 73
      var butts = make(panel, "div")
      butts.style.display = "inline-block"
      butts.style["float"] = "right"
      // item 74
      var save = make(butts, "div")
      // item 82
      setButtonStyle(
      	save,
      	"white",
      	SpecialBack,
      	"6px"
      )
      // item 85
      HtmlUtils.setDivText(
      	save,
      	translate("MES_SAVE")
      )
      // item 83
      var cancel = make(butts, "div")
      // item 84
      setButtonStyle(
      	cancel,
      	"white",
      	NormalBack,
      	"6px"
      )
      // item 86
      HtmlUtils.setDivText(
      	cancel,
      	translate("MES_CANCEL")
      )
      // item 87
      save.onclick = onSave
      cancel.onclick = hide
      // item 42
      return main
  }
  
  function fixIPadKeyboard() {
      // item 117
      if (window.scrollTo) {
          // item 116
          window.scrollTo(0, 0)
      }
      // item 120
      document.body.scrollTop = 0
      document.body.scrollLeft = 0
  }
  
  function handleTab(evt) {
      // item 170
      if (((evt.keyCode == 9) || (evt.key == "Tab")) || (evt.which == 9)) {
          // item 169
          insertTab(this, evt)
      }
  }
  
  function hide() {
      // item 66
      globs = {}
      // item 17
      HtmlUtils.hidePopup()
      // item 125
      fixIPadKeyboard()
  }
  
  function insertTab(edit, evt) {
      // item 163
      evt.preventDefault();
      var s = edit.selectionStart;
      edit.value = edit.value.substring(0,edit.selectionStart) + "\t" + edit.value.substring(edit.selectionEnd);
      edit.selectionEnd = s+1;
  }
  
  function isVisible() {
      // item 131
      return !!globs.visible
  }
  
  function make(parent, tag) {
      // item 36
      var element = document.createElement(tag)
      parent.appendChild(element)
      // item 38
      //element.ontouchstart = prevent
      //element.ontouchmove = prevent
      //element.ontouchend = prevent
      // item 37
      return element
  }
  
  function makeImagePath(image) {
      // item 64
      return "/static/images/" + image
  }
  
  function makeWindowTitle(main, headerText) {
      // item 192
      var header = make(main, "table")
      header.style.background = DarkBackground
      header.style.height = HeaderHeight + "px"
      header.style.width = "100%"
      var tr = make(header, "tr")
      // item 196
      var headerTd = make(tr, "td")
      headerTd.style.verticalAlign = "center"
      headerTd.style.color = "white"
      headerTd.style.paddingLeft = "3px"
      // item 195
      HtmlUtils.setDivText(headerTd, headerText)
      // item 193
      var imgTd = make(tr, "td")
      imgTd.style.width = HeaderHeight + "px"
      var img = make(imgTd, "img")
      img.draggable = false
      img.src = makeImagePath("cross.png")
      img.width = HeaderHeight
      img.height = HeaderHeight
      // item 194
      var style = img.style
      img.className = "common_button"
      style.cursor = "pointer"
      style.display = "inline-block"
      style["float"] = "right"
      // item 197
      return {
      	header: headerTd,
      	cross: img
      }
  }
  
  function moveCursorToEnd(textarea) {
      // item 205
      var length = textarea.value.length
      textarea.setSelectionRange(
      	length,
      	length
      )
  }
  
  function onSave() {
      // item 97
      var text = globs.editor.value
      // item 94
      if (globs.validator) {
          // item 92
          var message = globs.validator(text)
          // item 98
          if (message) {
              // item 108
              showError(message)
          } else {
              // item 109
              globs.callback(text)
              // item 110
              if (globs.isAsync) {
                  
              } else {
                  // item 122
                  hide()
              }
          }
      } else {
          // item 109
          globs.callback(text)
          // item 110
          if (globs.isAsync) {
              
          } else {
              // item 122
              hide()
          }
      }
  }
  
  function setButtonStyle(div, color, background, padding) {
      // item 80
      var style = div.style
      div.className = "common_button"
      HtmlUtils.noContext(div)
      style.cursor = "pointer"
      // item 81
      style.display = "inline-block"
      style.color = color
      style.background = background
      style.padding = padding
      style.borderRadius = BorderRadius
      style.marginTop = "7px"
      style.marginRight = "7px"
  }
  
  function setError(text) {
      // item 137
      showError(text)
  }
  
  function show(isAsync, header, text, callback, validator, x, y) {
      // item 93
      globs.callback = callback
      globs.validator = validator
      globs.visible = true
      globs.isAsync = isAsync
      // item 6
      var win = buildWindow(header, text)
      globs.main = win
      // item 151
      if (HtmlUtils.isMobile()) {
          // item 150
          HtmlUtils.setPosCorrected(
          	0,
          	0,
          	win
          )
      } else {
          // item 183
          if ((x === undefined) || (y === undefined)) {
              // item 182
              HtmlUtils.showAtCenter(
              	win
              )
          } else {
              // item 12
              HtmlUtils.setPosCorrected(
              	x,
              	y,
              	win
              )
          }
          // item 13
          HtmlUtils.setUpMovable(win, HeaderHeight)
      }
      // item 138
      moveCursorToEnd(globs.editor)
      globs.editor.focus()
  }
  
  function showError(text) {
      // item 126
      globs.main.style.height = null
      // item 106
      globs.error.style.display = "block"
      // item 107
      HtmlUtils.setDivText(globs.error, text)
  }
  
  function submit() {
      // item 143
      onSave()
  }
  
  
  this.show = show
  this.hide = hide
  this.isVisible = isVisible
  this.setError = setError
  this.submit = submit
  this.makeWindowTitle = makeWindowTitle
  }
  
  InputBox = new InputBoxModule(window, document)
  