function filterSelect(selectObj) {
	this.htmlSelect = selectObj;
	this.init = function() {
		if (!this.htmlSelect) {
			alert('Select object not defined.');
		}
		if (!this.htmlSelect.options) {
			alert('Select object options not defined.');
		}
		this.options = new Array();
		if (this.htmlSelect && this.htmlSelect.options) {
			for (var i = 0; i < this.htmlSelect.options.length; i++) {
				this.options[i] = new Option();
				this.options[i].text = this.htmlSelect.options[i].text;
				this.options[i].value = this.htmlSelect[i].value;
			}
		}
	}
	this.reset = function() {
		this.filter('');
	}
	this.filter = function(pattern) {
		var i = 0, index = 0, regexp, e;
		this.htmlSelect.options.length = 0;
		try {
			regexp = new RegExp(pattern, 'i');
		} catch (e) {
			return;
		}
		for (i = 0; i < this.options.length; i++) {
			var option = this.options[i];
			if (regexp.test(option.text)) {
				this.htmlSelect.options[index++] = new Option(option.text, option.value, false);
			}
		}
		if (this.htmlSelect.options.length == 0) {
			this.htmlSelect.options[0] = new Option("(No matches)", "", false);
		}
	}
	this.init();
}