jQuery.fn.contains = function(txt) { return jQuery(this).indexOf(txt) >= 0; }

function filterForm() {
	
	$('td.showRow').show();
	var searchTerm = $('#filterBox').val().toLowerCase();
	if(searchTerm != '') {
		$('td.showRow').hide();
		$('td.showRow[bands*=' + searchTerm + ']').show();
		$('td.showRow[venue*=' + searchTerm + ']').show();
		$('td.showRow[location*=' + searchTerm + ']').show();
	}
	
	//showListRowOdd,showListRowEven
	
	var i = 0;
	$('td.showRow').each(function(index, row) {
		if($(row).is(':visible')) {
			var off = 'showListRowOdd';
			var on = 'showListRowEven';
			if(i %2 == 0) {
				off = 'showListRowEven';
				on = 'showListRowOdd';
			}
			$(row).removeClass(off);
			$(row).addClass(on);
			i++;
		}
	});

}

var filterTimer;
$(document).ready(function() {
	$('#filterButton').click(filterForm);
	$('#filterBox').keyup(function() {
		clearTimeout(filterTimer);
		filterTimer = setTimeout(filterForm, 500);
		
	});
});