titem = null;
var lastselectedidx = 0;
var currdbidxs = [];
var selecteddb = {};

function formatHtml(unsafe)
{
    if(!unsafe){return "";}
    return unsafe.toString()
        .replace(/&/g, "&amp;")
        .replace(/</g, "&lt;")
        .replace(/>/g, "&gt;")
        .replace(/"/g, "&quot;")
        .replace(/'/g, "&#039;")
        .replace(/\n/g, '<br>')
        .replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');

}
function escapeRegExp(string) {
    return string.replace(/[.*+?^${}()|[\]\\