if(typeof(Joomla)==="undefined"){var Joomla={}}Joomla.combobox={};Joomla.combobox.transform=function(b,a){var c=new Element("option",{"class":"custom"}).set("text",Joomla.JText._("ComboBoxInitString","type custom..."));c.inject(b,"top");document.id(b).set("changeType","manual");b.addEvent("keypress",function(g){if((this.options.selectedIndex!=0)&&(this.get("changeType")=="auto")){this.options.selectedIndex=0;this.set("changeType","manual")}if((g.code>47&&g.code<59)||(g.code>62&&g.code<127)||(g.code==32)){var f=true}else{var f=false}if(this.options.selectedIndex==0){var d=this.options[0].value;if((f==true)||(g.key=="backspace")){if(d==Joomla.JText._("ComboBoxInitString","type custom...")){d=""}}if(g.key=="backspace"){d=d.substring(0,d.length-1);if(d==""){d=Joomla.JText._("ComboBoxInitString","type custom...")}this.set("changeType","manual")}if(f==true){d+=String.fromCharCode(g.code)}this.options.selectedIndex=0;this.options[0].text=d;this.options[0].value=d;g.stop()}});b.addEvent("change",function(d){if((this.options.selectedIndex!=0)&&(this.get("changeType")=="auto")){this.options.selectedIndex=0;this.set("changeType","manual")}});b.addEvent("keydown",function(h){if(h.code==8||h.code==127){h.stop();if(Browser.Engine.webkit||Browser.Engine.trident){this.fireEvent("keypress",h)}}if(this.options.selectedIndex==0){var g=String.fromCharCode(h.code).toLowerCase();for(var f=1;f<this.options.length;f++){var d=this.options[f].value.charAt(0).toLowerCase();if((d==g)){this.options.selectedIndex=0;this.set("changeType","auto")}}}});b.addEvent("keyup",function(d){if((d.key=="left")||(d.key=="right")){this.options.selectedIndex=0}if((this.options.selectedIndex!=0)&&(this.get("changeType")=="auto")){this.options.selectedIndex=0;this.set("changeType","manual")}})};window.addEvent("domready",function(){$$("select.combobox").each(function(a){Joomla.combobox.transform(a)})});