$(document).ready(function() 
{
	$('#twitterButton').click(function() 
	{
		$('#facebookTab').hide();
		$('#twitterTab').show();
		$('#twitterButton').addClass('active');			
		$('#facebookButton').removeClass('active');	
	});	

	$('#facebookButton').click(function() 
	{
		$('#facebookTab').show();
		$('#twitterTab').hide();
		$('#facebookButton').addClass('active');			
		$('#twitterButton').removeClass('active');
	});	
	
	$('.categoryList').hover(function()
	{
		$('.activeCatItem a').css('border-radius', '2px 2px 0px 0px');
		$('.activeCatItem a').css('-moz-border-radius', '2px 2px 0px 0px');
		$('.activeCatItem a').css('-webkit-border-radius', '2px 2px 0px 0px');
		$('.hiddenCatItem').each(function()
		{
			$(this).show();
		});
	},
	function()
	{
		$('.activeCatItem a').css('border-radius', '2px');
		$('.activeCatItem a').css('-moz-border-radius', '2px');
		$('.activeCatItem a').css('-webkit-border-radius', '2px');
		$('.hiddenCatItem').each(function()
		{
			$(this).hide();
		});
	});
	
	$('.intervalSortContainer').hover(function()
	{
		$('.active a').css('border-radius', '2px 2px 0px 0px');
		$('.active a').css('-moz-border-radius', '2px 2px 0px 0px');
		$('.active a').css('-webkit-border-radius', '2px 2px 0px 0px');
		$('.hiddenInterval').each(function()
		{
			$(this).show();
		});
	},
	function()
	{
		$('.active a').css('border-radius', '2px');
		$('.active a').css('-moz-border-radius', '2px');
		$('.active a').css('-webkit-border-radius', '2px');
		$('.hiddenInterval').each(function()
		{
			$(this).hide();
		});
	});
	
	$('.adminSorting').hover(function()
	{
		$('.active a').css('border-radius', '2px 2px 0px 0px');
		$('.active a').css('-moz-border-radius', '2px 2px 0px 0px');
		$('.active a').css('-webkit-border-radius', '2px 2px 0px 0px');
		$('.hiddenAdminSort').each(function()
		{
			$(this).show();
		});
	},
	function()
	{
		$('.active a').css('border-radius', '2px');
		$('.active a').css('-moz-border-radius', '2px');
		$('.active a').css('-webkit-border-radius', '2px');
		$('.hiddenAdminSort').each(function()
		{
			$(this).hide();
		});
	});
	
	/** CALCULATING THE SOCIAL TAB HEIGHT **/
	var contentHeight = 0;
	var rightColHeight = 0;
	var topHeight = 0;
	var midHeight = 0;
	var commercial = 0;
	var follow = 0;
	var social = 0;
	var excess = 0;
	
	if($('.redactieTab').length > 0)
	{
		topHeight = parseInt($('.redactieTab').css('height').replace('px', ''));
		midHeight = parseInt($('.mainCol #tabContainer').css('height').replace('px', ''));
		
		contentHeight = topHeight + midHeight;
	}
	if($('.videoTab').length > 0)
	{
		topHeight = parseInt($('.videoTab').css('height').replace('px', ''));
		midHeight = parseInt($('.mainCol #tabContainer').css('height').replace('px', ''));
		
		contentHeight = topHeight + midHeight;
	}
	
	if($('#commercialFrame').length > 0)
	{
		commercial = parseInt($('#commercialFrame').css('height').replace('px', ''));
		commercial = commercial + parseInt($('#commercialFrame').css('margin-bottom').replace('px', ''));
	}
	if($('#followUs').length > 0)
	{
		follow = parseInt($('#followUs').css('height').replace('px', ''));
		follow = follow + parseInt($('#followUs').css('margin-bottom').replace('px', ''));
	}
	if($('.rightCol #tabContainer').length > 0)
	{
		social = parseInt($('.rightCol #tabContainer').css('height').replace('px', ''));
	}
	
	rightColHeight = follow + commercial + social;
	
	excess = contentHeight - rightColHeight;
	
	if(excess > 0)
	{
		currentHeight = parseInt($('.rightCol .socialTabContent').css('height').replace('px', ''));
		newHeight = (currentHeight + excess - 4) + 'px';
		
		$('.rightCol .socialTabContent').css('height',newHeight);
	}
	
});

