selector={select:null,input:null,button:null,goodbrowser:false,alloptions:[],filter_init:function(strsearch,selectinputid){selector.goodbrowser=!(' '+document.body.className+' ').match(/ ie | safari /);selector.select=document.getElementById(selectinputid);selector.button=document.getElementById('settingssubmit');for(var i=0;i<selector.select.options.length;i++)selector.alloptions[i]=selector.select.options[i];var div=document.createElement('div');div.id='searchui';var input=document.createElement('input');input.type='text';input.id=selectinputid+'_search';selector.input=input;var label=document.createElement('label');label.htmlFor=input.id;label.appendChild(document.createTextNode(strsearch+' '));div.appendChild(label);div.appendChild(input);selector.select.parentNode.insertBefore(div,selector.select);input.addEventListener('keyup',selector.filter_change)},filter_change:function(){var searchtext=selector.input.value.toLowerCase(),found=false;for(var i=0;i<selector.alloptions.length;i++){var option=selector.alloptions[i];if(option.text.toLowerCase().indexOf(searchtext)>=0){selector.set_visible(option,true);found=true}else selector.set_visible(option,false)};if(found){selector.input.className=""}else selector.input.className="error"},set_visible:function(element,visible){if(selector.goodbrowser){if(visible){element.style.display='block'}else{element.style.display='none';element.selected=false}}else if(visible){if(element.parentNode.tagName.toLowerCase()==='span')element.parentNode.parentNode.replaceChild(element,element.parentNode);element.enabled=true}else{if(element.parentNode.tagName.toLowerCase()!=='span'){var span=document.createElement('span');element.parentNode.replaceChild(span,element);span.appendChild(element);span.style.display='none'};element.enabled=false;element.selected=false}}}