/*
* jQuery Combobox with autocomplete plugin
* www.frebsite.nl
* Copyright (c) 2009 Fred Heusschen
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
$.fn.combobox = function(settings) {
var opts = $.extend({}, $.fn.combobox.defaults, settings);
if (!$('#combo_overlay').length) {
$('body').append('
');
$('#combobox_overlay').unbind('click').click($.fn.combobox.sluitSelect);
}
return this.each(function() {
var el = $(this);
var id = el.attr('id');
var ic = (id.length > 0) ? ' id="combobox_container_'+id+'"' : '';
id = (id.length > 0) ? ' id="'+id+'"' : '';
var na = (el.attr('name').length) ? ' name="'+el.attr('name')+'"' : '';
var ti = (el.attr('tabindex').length) ? ' tabindex="'+el.attr('tabindex')+'"' : '';
var cb = '';
cb += '';
if (opts.buttonText.length > 0) {
cb += ''+opts.buttonText+'';
}
cb += '
';
$('option', el).each(function() {
var t = $(this).html();
var c = ($(this).attr('class').length) ? ' class="'+$(this).attr('class')+'"' : '';
var v = $(this).attr('value');
if (!v.length) v = t;
cb += '