(function($){$.fn.editableCombobox=function(options){var defaults={position:0,classes:'',styles:{},pluginClass:'jecEditableOption',ignoredKeys:[],acceptedRanges:[{min:32,max:126},{min:191,max:382}]};var options=$.extend(defaults,options);if($.browser.msie){Array.prototype.indexOf=function(object){for(var i=0;i<this.length;i++){if(this[i]==object){return i;}}return-1;}}return $(this).filter('select').each(function(){if($(this).children(options.pluginClass).length==0){var editableOption=$(document.createElement('option'));editableOption.addClass(options.pluginClass).hide();if(typeof(options.classes)=='string'){editableOption.addClass(options.classes);}else if(typeof(options.classes)=='object'){for(var i=0;i<options.classes.length;i++){editableOption.addClass(options.classes[i]);}}if(typeof(options.styles)=='object'){for(var i=0;i<options.styles.length;i++){editableOption.append(options.styles[i]);}}if($(this).children().eq(options.position).length!=0){$(this).children().eq(options.position).before(editableOption);}else{$(this).append(editableOption);}}$(this).keypress(function(event){switch(event.which){case 8:var option=$(this).children('option.'+options.pluginClass);if(option.val().length>1){$(this).children(':selected').removeAttr('selected');var value=option.val().substring(0,option.val().length-1);option.val(value).text(value).attr('selected','selected').show();}else if(option.val().length==1){option.val('').text('').hide();}break;default:if(options.ignoredKeys.indexOf(event.which)==-1){$(this).children(':selected').removeAttr('selected');keyValue='';for(validKey in options.acceptedRanges){if((typeof(options.acceptedRanges[validKey].exact)!='undefined'&&options.acceptedRanges[validKey].exact==event.which)||(typeof(options.acceptedRanges[validKey].min)!='undefined'&&typeof(options.acceptedRanges[validKey].max)!='undefined'&&event.which>=options.acceptedRanges[validKey].min&&event.which<=options.acceptedRanges[validKey].max)){keyValue=String.fromCharCode(event.which);}}var option=$(this).children('option.'+options.pluginClass);var value=option.val()+keyValue;option.val(value).text(value).attr('selected','selected').show();}break;}});$(this).keydown(function(event){return(event.which!=8);});});};})(jQuery);