/*
	DynAPI Distribution
	HTMLListbox Class
	The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
	
	Requires: HTMLComponent
*/
function HTMLListbox(css,items,length,multiSelect,title,elmName){
	this.HTMLComponent = HTMLComponent;
	this.HTMLComponent(css);
	
	this._elmId = elmName||(this.id+'LST');
	this._lIndex = 0; // last index
	this._opts = items||[];
	this._length = (length>2)? length:5;
	this._defEvtResponse = true;
	this.setMultiSelect(multiSelect);
};
var p = dynapi.setPrototype('HTMLListbox','HTMLComponent');
p._inlineEvents+=' onchange="return htc._e(\'change\',this,event);" ';
// Methods
p._oldHCLBEvt = HTMLComponent.prototype._e;
p._getDSValue = function(){ // DataSource functions
	return this.getSelected();
};
p._setDSValue = function(d){
	this.setSelected(d);
};
p._e = function(evt,elm,arg){
	if(evt=='change') this._selected = this._getSelValues();
	return this._oldHCLBEvt(evt,elm,arg);
};
p._assignElm = function(elm){
	if(!this.parent) return;
	else if(!this.parent._created) return;
	var doc=this.parent.doc;
	if(!elm) {
		if(dynapi.ua.ie) elm=doc.all[this._elmId];
		else if(dynapi.ua.dom) elm=doc.getElementById(this._elmId);
		else if(dynapi.ua.ns4){
			for(i=0;i'+o[i]+'';
	}
	return h.join('\n');
};
p._getSelValues = function(){
	if(!this.getElm()) return this._selected;
	else {	
		var sel;
		var opt = this.elm.options;
		var inx = opt.selectedIndex;
		if(inx<0) return;
		if(!this._msel) sel=opt[inx].value;
		else {
			sel = [];
			for(var i=0;i'+this._buildOptions()+'';
};
p.addItem = function(text,value,selected){
	if(value==null) value=this._lIndex;
	this._opts[value]=text;
	if(!this._msel && selected) this._selected=value;
	else if(this._msel && selected) this._selected+=value+'||';
	if(this.getElm()){
		var l=this.elm.options.length;
		this.elm.options[l]=new Option(text,value);
	}
	return this._lIndex++;
};
p.getItem = function(index){
	if(index!=null && this.getElm()) {
		var o = this.elm.options;
		if(typeof(index)=='number' && (index>=0 && index