var liveSearch = new Class({
	initialize: function() {
		this.partList = $('participantsList');
		this.partBox = $('liveSearchParticipants');
		if (this.partList && this.partBox) {
			this.setLiveSearch();
		}
	},
	partList: false,
	partBox: false,
	listElements: false,
	setLiveSearch: function() {
		this.partBox.addEvent('keyup', this.updateList.bind(this));
		this.listElements = this.partList.getElementsByTagName('li');
		this.listElements = $A(this.listElements);
	},
	updateList: function() {
		searchVal = this.partBox.getValue();
		if (searchVal != "")
		{
			regexp = '/'+searchVal+'/i';
			this.listElements.each(function(el){
				value = el.innerHTML;
				result = value.test(eval(regexp));
				if (result == false)
				{
					el.style.display = 'none';
				}
				else
				{
					el.style.display = 'block';
				}
			});
		}
	}
});

window.addEvent('domready', function() { new liveSearch; } );