/**
 * @author  Łukasz
 */
	$(function() {
		$("#tabs").tabs();
		
		if($('.sbs_counter_info').length && $('#sbs_counter').length)
		{
			$('.sbs_over').mouseenter(function() { $('.sbs_counter_info').fadeIn(); });
			$('.sbs_over').mouseleave(function() { $('.sbs_counter_info').fadeOut(); });
		}
		
		if($('.fb-panel').length)
		{
			$('.fb-open').live('click.fb', function() {
				$('body').unbind('.fb');
				$('.fb-close').unbind('.fb');
				$('.fb-panel').animate({
				    left: 0
				  }, 1000, function() {
					  $('.fb-open').fadeOut('fast', function() {
						  $('.fb-close').fadeIn('fast', function(){
							  $('.fb-close, body').bind('click.fb', function(){
								  $('.fb-panel').animate({
									  left: -380
								  }, 1000, function() {
									  $('.fb-close').fadeOut('fast', function() {
										  $('.fb-open').fadeIn('fast', function(){});
									  });
									  $('body').unbind('.fb');
									  $('.fb-close').unbind('.fb');
								  });
							  });
						  });
					  });
				  });
			});
		}
	});
	var sbs_counter_handler = null;
	function showFbHelp() {
		if($('.fb_help').attr('rel') == 'show'){
			$('.fb_help').show();
			$('.fb_help').attr('rel','hide');
		}
		else
		{
			$('.fb_help').attr('rel', 'show');
			$('.fb_help').hide();
		}		
	}
	function update_sbs_counter()
	{

		$.post(sbs_update_link, {}, function(response){
			if ($('#sbs_counter p').html() != response.counter) {
				$('#sbs_counter p').fadeOut(1000, function() {
					$('#sbs_counter p').html(response.counter);	
					$('#sbs_counter p').fadeIn(1000);
				});
				
			}
			if(response.counter > 0)
				sbs_counter_handler = setTimeout("update_sbs_counter()", 60000);
		}, "json");
	}
	function init_sbs_counter() 
	{
		sbs_counter_handler = setTimeout("update_sbs_counter()", 60000);
	}

