function filterFixtures (control, table_id) {
	var tbl = document.getElementById(table_id);
	if (tbl == undefined || tbl == null) return;

	var rows = tbl.getElementsByTagName('tr');
	for (var i = 0; i < rows.length; i++) {
		var cells = rows[i].getElementsByTagName('td');
		var home = cells[1].firstChild.nodeValue;
		var away = cells[5].firstChild.nodeValue;
		if (control.options[control.selectedIndex].value == home || control.options[control.selectedIndex].value == away || control.options[control.selectedIndex].value == "-1") {
			rows[i].style.display = 'table-row';
		} else {
			rows[i].style.display = 'none';
		}
	}
}

function filterOnLoad () {
	filterFixtures(document.getElementById('fixture-filter'), 'fixtures');
}

$(document).ready(filterOnLoad);
