// JavaScript Document
function htmlSelect(name)
{
	var htmlObject = document.getElementById(name);
	// core functions
	this.add = function(value,text){
		this.enable();
		value = Number(value);
		newOption = new Option(text,value);
		try {
			htmlObject.add(newOption,null)
		} catch(ex) {
			htmlObject.add(newOption);
		}
		//value = value+0;
		/* try {
    elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
  }
  catch(ex) {
    elSel.add(elOptNew); // IE only
  }*/
		//htmlObject.options[htmlObject.length]=new Option(text,value);;
	}
	this.disable = function(){
		htmlObject.disabled=true;
	}
	this.enable = function(){
		htmlObject.disabled=false;
	}
	this.empty = function(){
		htmlObject.length=0;
	}
	this.selectedId = function(){
		return htmlObject.selectedIndex;
	}
	this.resetField= function(){
		htmlObject.selectedIndex=0;
	}
	this.wipe = function(){
		this.empty();
		this.add('','- please select -');
	}
	// 2nd level
	this.getValue = function(){
		return htmlObject.options[this.selectedId()].value;
	}
	this.removeOption = function(){
		htmlObject.remove(this.selectedId());
	}
	this.getLength = function(){
		return htmlObject.length;
	}
}
