// JScript source code

// Script to allow type-ahead in list boxes
var eObj;
function skipTo(e) {
  keyCode = (e.keyCode)?e.keyCode:e.which;
  if (keyCode == 32 || keyCode > 47) {
    theSel = (e.srcElement)?e.srcElement:e.target;
    query = theSel.query += String.fromCharCode(keyCode).toLowerCase();
    window.status = "Query: "+query;
    opt = theSel.options;
    for(var i=0;i<opt.length;i++){
      if(opt[i].text.toLowerCase().substr(0,query.length)==query){
        theSel.selectedIndex = i;
        if (e.preventDefault) {
          eObj = theSel;
          setTimeout("eObj.selectedIndex = "+i,1);
        }
        return false;
      }
    }
    theSel.query = "";
    window.status = "Query: "+query+" (not found)";
    return false;
  }
  return true;
}
function initSkipList(objSelect){
  objSelect.query='';
  objSelect.focus();
}
