var isOpera=navigator.userAgent.indexOf("Opera")>-1;var isIE=navigator.userAgent.indexOf("MSIE")>1&&!isOpera;var isMoz=navigator.userAgent.indexOf("Mozilla/5.")==0&&!isOpera;function textboxSelect(c,b,a){switch(arguments.length){case 1:c.select();break;case 2:a=c.value.length;case 3:if(isIE){var d=c.createTextRange();d.moveStart("character",b);d.moveEnd("character",-c.value.length+a);d.select();}else{if(isMoz){c.setSelectionRange(b,a);}}}c.focus();}function textboxReplaceSelect(b,c){if(isIE){var d=document.selection.createRange();d.text=c;d.collapse(true);d.select();}else{if(isMoz){var a=b.selectionStart;b.value=b.value.substring(0,a)+c+b.value.substring(b.selectionEnd,b.value.length);b.setSelectionRange(a+c.length,a+c.length);}}b.focus();}function autocompleteMatch(a,c){a=a.toLowerCase();for(var b=0;b<c.length;b++){strDB=c[b].toLowerCase();if(strDB.indexOf(a)==0){return c[b];}}return null;}function autocomplete(c,b,d){switch(b.keyCode){case 38:case 40:case 37:case 39:case 33:case 34:case 36:case 35:case 13:case 9:case 27:case 16:case 17:case 18:case 20:case 8:case 46:return true;break;default:textboxReplaceSelect(c,String.fromCharCode(isIE?b.keyCode:b.charCode));var a=c.value.length;var e=autocompleteMatch(c.value,d);if(e!=null){c.value=e;textboxSelect(c,a,c.value.length);}return false;}}