function setText()
{
	list=window.document.getElementById("listNames");
	if (list.selectedIndex!=0)
	{
		window.document.getElementById("textName").value=list[list.selectedIndex].text;
	}
	else
	{
		window.document.getElementById("textName").value="";
		window.document.getElementById("textName").focus();
	}
}

charArray=new Array();
charArray[0]="'";
charArray[1]=",";
charArray[2]="-";
charArray[3]=" "

function removeChars(pattern)
{
	for (i=0; i<charArray.length;i++)
	{
		pattern=pattern.replace(charArray[i],"");
	}
	return pattern
}

function filter(pattern, list){
   if (!list.bak){
    list.bak = new Array();
    for (n=0;n<list.length;n++){
      list.bak[list.bak.length] = new Array(list[n].value, list[n].text);
    }
}

match=-1
nomatch = new Array();
pattern=removeChars(pattern);
for (n=0;n<list.bak.length;n++){
listStuff=removeChars(list.bak[n][1]);
shortPattern=listStuff.toLowerCase().slice(0,pattern.length);
if(shortPattern.indexOf(pattern.toLowerCase())!=-1)
{
   match=n;
   break;
}

}

if (match!=-1)
  {
		list.selectedIndex=match;
  }
}

