function findtext(thisedt,sought) //thisedt = textEdit to be searched. //sought = string to be searched for. {    //both toLowerCase for case-insensitive search    var lc = thisedt.GetText().toLowerCase();    sought = sought.toLowerCase();    //current cursor position is start for search    var curs = thisedt.GetCursorPos();    //only compare against the searchable range    lc = lc.slice(curs+1)    // try to find next occurence of sought    var pos = lc.search(sought);    if ( pos > -1)    {        //we found it       pos  = pos + curs +1       thisedt.SetCursorPos(pos)       thisedt.SetSelection(pos, pos+sought.length);    }    else    {       //not found - go to start of text       //user can search again from there if required.       thisedt.SetCursorPos(0)    } }