context:   setOptions: function(options) {    this.options = Object.extend({      choices: 10,      partial_search: true,      partial_chars: 2,      ignore_case: true,      full_search: false,      selector: function(instance) {        var ret       = new Array(); // Beginning matches        var partial   = new Array(); // Inside matches        var entry     = instance.getEntry();        var count     = 0;                for (var i = 0; i < instance.options.array.length &&              ret.length < instance.options.choices ; i++) {           var elem = instance.options.array[i];          var found_pos = instance.options.ignore_case ?             elem.toLowerCase().indexOf(entry.toLowerCase()) :             elem.indexOf(entry);          while (found_pos != -1) {            if (found_pos == 0 && elem.length != entry.length) {               ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +                 elem.substr(entry.length) + "</li>");              break;            } else if (entry.length >= instance.options.partial_chars &&               instance.options.partial_search && found_pos != -1) {              if (instance.options.full_search || /\s/.test(elem.substr(found_pos-1,1))) {                partial.push("<li>" + elem.substr(0, found_pos) + "<strong>" +                  elem.substr(found_pos, entry.length) + "</strong>" + elem.substr(                  found_pos + entry.length) + "</li>");                break;              }            }            found_pos = instance.options.ignore_case ?               elem.toLowerCase().indexOf(entry.toLowerCase(), found_pos + 1) :               elem.indexOf(entry, found_pos + 1);          }        }        if (partial.length)          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))        return "<ul>" + ret.join('') + "</ul>";      }    }, options || {});  }
meta: 3158	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/3158/3f913f897829fb026ef98df2d57f8da94ee5339d/controls.js/clean/public/javascripts/controls.js