function equalWidth(group, ile) {
	parentWidth = $(group).width();
	tdWidth = Math.floor((parentWidth - ((ile-1)*2))/ile);

	$('.tb_equal', group).width(tdWidth);
}

$(document).ready(function(){

	$('.tripplebox table').removeAttr('style');
	equalWidth($(".tripplebox"), 3);

	$('.tabs .tcontc .tcitem').css('display','none');
	$('.tabs .tcontc .tcitem.tcsel').css('display','block');

	$('.tabs .tbar .tbitem').each(function(){
		if($('.tbitems', $(this)).text() == '') $(this).hide();
	});

	$('.tabs .tbar .tbitem').click(function(){
		$('.tbitem', $(this).parent()).removeClass('tbsel');
		$(this).addClass('tbsel');

		var pokapoka = $('.tbitem', $(this).parent()).index($(this)) + 1;
		$('.tcont .tcontc .tcitem', $(this).parent().parent()).removeClass('tcsel').css('display','none');
		$('.tcont .tcontc .tcitem:nth-child(' + pokapoka + ')', $(this).parent().parent()).addClass('tcsel').css('display','block');
		//alert(pokapoka);
	});

	$('.component_gray .divmore a.more2, .component_orange .divmore a.more2').click(function(){
		if($(this).text() == 'więcej'){
			$('.overflow', $(this).parent().parent()).css('height','auto');
			$(this).text('mniej');
		}
		else{
			$('.overflow', $(this).parent().parent()).removeAttr('style');
			$(this).text('więcej');
		}
		return false;
	});

	
});


