function listbox()
	{
	this.object = null;
	this.load = lst_load;
	this.loadXML = lst_loadXML;
	this.setValue = lst_setValue;
	this.getValue = lst_getValue;
	this.getText = lst_getText;
	this.clear = lst_clear;
	this.clearFrom = lst_clearFrom;
	this.maxLength = null;
	this.xmlDoc = null;
	}
	
function lst_load(xmlPath,tagElement,nameAttribute,valueAttribute){
	this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	this.xmlDoc.async = false;
	//alert(xmlPath)
	if (!this.xmlDoc.load(xmlPath)) return false;
	//alert(this.xmlDoc.xml)
	var rs = this.xmlDoc.getElementsByTagName(tagElement);
	var from = this.object.options.length;
	for (i=from;i<rs.length+from;i++){
		if ((rs[i-from].getAttribute(nameAttribute) !=null) && (rs[i-from].getAttribute(valueAttribute) != null)){
			var nom = rs[i-from].getAttribute(nameAttribute)
			if (this.maxLength!=null)
				nom = nom.substr(0,this.maxLength)
			this.object.options[i]  = new Option(nom, rs[i-from].getAttribute(valueAttribute), false, false);
		}
	}
	return true;
}
	
function lst_loadXML(xmlPath,tagElement,nameAttribute,valueAttribute){
	this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	this.xmlDoc.async = false;
	if (!this.xmlDoc.loadXML(xmlPath)) return false;
	var rs = this.xmlDoc.getElementsByTagName(tagElement);
	var from = this.object.options.length;
	for (i=from;i<rs.length+from;i++){
		if ((rs[i-from].getAttribute(nameAttribute) !=null) && (rs[i-from].getAttribute(valueAttribute) != null)){
			var nom = rs[i-from].getAttribute(nameAttribute)
			if (this.maxLength!=null)
				nom = nom.substr(0,this.maxLength)
			this.object.options[i]  = new Option(nom, rs[i-from].getAttribute(valueAttribute), false, false);
		}
	}
	return true;
}

function lst_setValue(value)
	{
	for (i=0;i<this.object.options.length;i++)
		if (this.object.options[i].value==value)
			{
			this.object.options[i].selected = true;
			return;
			}
	return;
	}
function lst_getValue()
	{
	return this.object.options[this.object.options.selectedIndex].value;
	}
function lst_getText()
	{
	return this.object.options[this.object.options.selectedIndex].text;
	}
function lst_clear()	
	{
	return this.object.options.length=0;
	}
function lst_clearFrom(num)	
	{
	return this.object.options.length=num;
	}
