$(function(){

	// Init for pool tabs
	$('#pool-nav a').click(function(){
		if ($(this).parents('li.active').length == 0) {
			pooltabSwitch(this);
		}
		this.blur();
		return false;
	});
  // Hide em all
  $('#pool-info .item-list > ul > li').css('display', 'none');
  // Activate current pool tab, or default to the first pool
  if ($('#pool-nav a.current').length) {
    pooltabSwitch($('#pool-nav a.current').eq(0));
  } 
  else {
    pooltabSwitch($('#pool-nav a').eq(0));
  }
	
});

function pooltabSwitch(tab) {
	// Let's reset em all
	$('#pool-nav li').removeClass();
	$('#pool-info li.active').fadeOut('fast').removeClass();
	
	// Activate respective tab
	$(tab).parent('li').addClass('active');
	var showId = $(tab).attr('href');
	// Clean showId to work on all browsers
	showId = showId.split('#');
	showId = '#' + showId[1];
	$(showId).fadeIn('fast').addClass('active');
}