Hello all, this is my first post on this site, hopefully this is in the right place.

I've written this simple jscript function, that filters results from an array into a DIV based on whatever I type into a text box. - then when I click on one of the results, it drops the value into the Textbox.

Its working as expected, just very slow for the first 2 characters that I type? after that its works OK..
until I delete the line and start typing again.

The array is 850 rows long,

Tried it on 3 different PCs, different browsers etc. all the same

has anyone else done this and had better results?

Thanks in advance!
Dave


Code:
 <script>
        function updSrch(val2) {
            document.getElementById("orig").value = val2;
            document.getElementById("divnames").style.display = "none";
        }

        function hideit() {
            document.getElementById("divnames").style.display = "none";
        }

        function findit(val1) 
        {
            document.getElementById("divnames").style.display = 'none';
            document.getElementById("divnames").innerHTML = "";
            document.getElementById("divnames").innerHTML += "<div style='position:absolute; top:1px; right:1px;'><a href='#' style='color:Red' onclick='hideit()'>[X]</a></div>"
           for (var i = 0; i < ADUser.length; i++) 
           {           
                if (ADUser[i].indexOf(val1) === -1){
                } else {
                    document.getElementById("divnames").style.display = 'block';
                
                var theline = ADUser[i];
                var spl = theline.split(",");
                var asp = "'" + spl[0] + "'";

                var Str = '<br><a onclick="updSrch(' + asp + ')" style="color:#524CFF; cursor:pointer;" >' + spl[1] + ' ' + spl[2] + '</a>';
                document.getElementById("divnames").innerHTML += Str;
                };
            };            
         }
    </script>


   <input type='text' id='orig' Width="250px" style='min-width:250px' onkeyup='findit(this.value);' >
   <i style='color:#909090'>Username from Active Directory only</i>
                
                <div style='
                    display:none;
                    background-color:#e6e6e6; 
                    width:200px; min-height:10px;
                    border:1px solid #808080;
                    padding:3px;
                    position:relative;
                    ' id='divnames'>
                     
                    

                </div>