/*
function querySave () {
queries.push(queries[0])
var choices = dom.getElementById('queryChoices')
var next = dom.createElement('option')
var box = dom.createElement('input')
var index = queries.length - 1
box.setAttribute('type', 'checkBox')
box.setAttribute('value', index)
choices.appendChild(box)
choices.appendChild(dom.createTextNode('Saved query #' + index))
choices.appendChild(dom.createElement('br'))
next.setAttribute('value', index)
next.appendChild(dom.createTextNode('Saved query #' + index))
dom.getElementById('queryJump').appendChild(next)
}
 /*
function resetQuery () {
function resetOutliner (pat) {
var n = pat.statements.length
var pattern, tr
for (let i = 0; i < n; i++) {
pattern = pat.statements[i]
tr = pattern.tr
UI.log.debug('tr: ' + tr.AJAR_statement);
if (typeof tr !== 'undefined') {
delete tr.AJAR_pattern
delete tr.AJAR_variable
}
}
for (let x in pat.optional) { resetOutliner(pat.optional[x]) }
}
resetOutliner(myQuery.pat)
UI.utils.clearVariableNames()
queries[0] = myQuery = new QueryObj()
}
function addButtonCallbacks (target, fireOn) {
    UI.log.debug('Button callbacks for ' + fireOn + ' added')
    var makeIconCallback = function (icon) {
      return function IconCallback (req) {
        if (req.indexOf('#') >= 0) {
          console.log('@@ makeIconCallback: Not expecting # in URI whose state changed: ' + req)
            // alert('Should have no hash in '+req)
        }
        if (!target) {
          return false
        }
        if (!outline.ancestor(target, 'DIV')) return false
        // if (term.termType != 'symbol') { return true } // should always ve
        if (req === fireOn) {
          target.src = icon
          target.title = outlineIcons.tooltips[icon]
        }
        return true
      }
    }
    sf.addCallback('request', makeIconCallback(outlineIcons.src.icon_requested))
    sf.addCallback('done', makeIconCallback(outlineIcons.src.icon_fetched))
    sf.addCallback('fail', makeIconCallback(outlineIcons.src.icon_failed))
  }