$(document).ready(function() {
	wt_runnerstab();
});

function wt_reviseresults(resp) {
//	alert("Called results table update"); 
	$('#runners').html(resp);
	$('#runners').fadeIn("fast");

	wt_runnerstab();
}

function wt_runnerstab() {
	
	//alert("In Javascript function");
	$('#stripeme tr:even').addClass("shadow");
	$('#stripeme tr').mouseover(function(){$(this).addClass("over");});
	$('#stripeme tr').mouseout(function(){$(this).removeClass("over");});
	
	$('#stripeme tr') .click(function() {
		if ($(this).hasClass('clicked'))
			$(this).removeClass('clicked');
	   	else
			$(this).addClass("clicked");
	});
	
	$('#runners th a') .click(function(event) {
		var attrs = $(this).attr("id");
//		alert("Calling with params: " + attrs);

		event.preventDefault();
//		$('#runners').fadeOut("fast");

		$.ajax({
			type: "GET",
			dataType: "html",
			url: "db/resultstable.php",
			data: attrs,
			success: function(resp) { wt_reviseresults(resp); }
		});

		return false;
	});
}