
function jh_combo(id) {
	this.combo = null;
	this.defaultValue = '';
	this.defaultText = '';
	this.id = id;
	this.form = '';
	this.width = 200;
	this.type = '';
	this.ajax = '';
	this.cookieid = '';
	this.enable_filtering = true;
	this.enable_reload = true;
	
	this.text = '';
	this.value = '';
	
	this.load = function() {
		if (document.getElementById(this.id)) {
			window.dhx_globalImgPath='/img/dhtmlx/imgs/';

			// combo bereits zuvor existent?
			if (this.combo) {
				this.text = this.combo.getComboText() ? this.combo.getComboText() : this.text;
				this.value = this.combo.getSelectedValue() ? this.combo.getSelectedValue() : this.value;
			}
			
			document.getElementById(this.id).innerHTML = '';
			this.combo = new dhtmlXCombo(this.id, this.form, parseInt(this.width), this.type);
			if (this.enable_reload) {
				this.combo.enableFilteringMode(this.enable_filtering, this.ajax + '&cid=' + this.cookieid, true, true);
			} else {
				this.combo.enableFilteringMode(this.enable_filtering);
				this.combo.readonly(!this.enable_filtering, false);
				this.combo.loadXML(this.ajax + '&cid=' + this.cookieid);
			}
			this.combo.DOMelem_hidden_input2.parentNode.removeChild(this.combo.DOMelem_hidden_input2);	// komisches _new_value entfernen
			this.combo.setComboText(this.text);
			document.getElementsByName(this.form)[0].value = this.value;
		}
	}

	this.setDefault = function(text, value) {
		this.text = text;
		this.value = value;
		if (this.combo) this.combo.setComboText(text);
	}

	this.onSelectionChange = function(func) {
		if (this.combo) {
			this.combo.attachEvent('onSelectionChange', func);
		}
	}
}


