const createTextArea = (elm, x, y) => {
    let textAreaElm = document.createElement("TEXTAREA");
    textAreaElm.style.position = "absolute";
    textAreaElm.style.top      = y + "px";
    textAreaElm.style.left     = x + "px";
    elm.appendChild(textAreaElm);
    textAreaElm.focus();
}

const newTabOrPage = (elm, domLoc, text) => {
    let toLoc    = document.getElementById(domLoc);
    let liElm    = document.createElement("LI");
    let textNode = document.createTextNode(text);
    liElm.appendChild(textNode);
    toLoc.insertBefore(liElm, elm);

    // Clear out old pages for new tab.
    // Will do a save data call b4 unloading
    if (domLoc == "tabs") {
        let pagesElm = document.getElementById("pages");
        let size     = pagesElm.childNodes.length - 2; // Excluding +
        for (var i = 0; i < size; i++) {
            pagesElm.removeChild(pagesElm.firstChild);
        }
    }
}
