Alexko64,
замените
function fnSearch(arr, pattern) {
pattern = escapeRegExp(pattern);
pattern = new RegExp("(" + pattern.trim().replace(/\s+/g, "|") + ")", "i");
return arr.filter(function(el) {
pattern.lastIndex = 0;
return pattern.test(el.name)
})
};