You can do it by just adding a bit to your current .click() handler, like this:
$(this).click(function(){
$(this).closest('tr').toggleClass('visited').siblings().removeClass('visited');
});
You can test it out here. As you get more elements though, the row level handler gets less efficient and you should look at .delegate() instead, like this:
$('table tr:even').addClass('even');
$('table tbody').delegate('tr', 'mouseenter', function() {
$(this).addClass("active");
}).delegate('tr', 'mouseleave', function() {
$(this).removeClass("active");
}).delegate('tr', 'click', function(){
$(this).closest('tr').toggleClass('visited').siblings().removeClass('visited');
});
You can test that version here, if you don't go this route, at least move the
$('table tr:even').addClass('even'); outside the loop, it only needs to run once :)