$(function() {
	$('#members_list table tr td a').text('Show email').click(function() {		
		var $this = $(this),
			parts = $this.attr('href').split("/"),
			id = parts[3],
			$p = $this.parent().eq(0);
		$p.empty().text('Retrieving...');
		$.getJSON('/assets/jsp/members_directory.jsp?id='+id, function(data, status) {
			if ('string' != typeof data.email || 'success' != status) $p.html('<span style="color:#650000">Email not found!</span>');
			else $p.html('<span style="color:#339933">'+data.email+'</span>');
		});
		return false;
	});
});