"use strict";

const searchCategories = {
  elements: {
    title: "Elements",
    itemTooltip: ["global element", "local element"],
    indexArray: null
  },
  attributes: {
    title: "Attributes",
    itemTooltip: "attribute",
    indexArray: null
  },
  complexTypes: {
    title: "Complex Types",
    itemTooltip: "complexType",
    indexArray: null
  }
};

var searchTargetMaps; // files: 125, targets: 268

var updateSearchResults = function() {};

function indexFilesLoaded()
{
  for (const name in searchCategories)
  {
    if (! searchCategories[name].indexArray)
      return false;
  }
  
  return searchTargetMaps;
} 

function loadScripts(doc, tag) 
{
  createElem(doc, tag, 'search.js');
  createElem(doc, tag, 'search-indexes.js');
  createElem(doc, tag, 'search-targets.js');  
}

function createElem(doc, tag, path)
{
  var script = doc.createElement(tag);
  var scriptElement = doc.getElementsByTagName(tag)[0];
  script.src = pathToRoot + 'search/' + path;
  scriptElement.parentNode.insertBefore(script, scriptElement);
}