function abs_pro()
{
	var h = $('#contentholder').height();
	var o = $('.projekt').map(function(){
		return $(this).position();
	});
	
	var zindex = o.length+5;
	$('.projekt').each(function(i,e){
		var e = $(e);
		e.css('position','absolute');
		e.css('z-index',zindex--);
		e.css('left',o[i].left+'px');
		e.css('top',o[i].top+'px');
	});
	$('#contentholder').height(h);
}

$(function(){
	abs_pro();
	//var zindex = 5;
	$('.big').show();
	$('.projekt').css('background-position','0 0');
	$('.ikony img').mouseover(function(){
		var e = $('#hint');
		var f = $(this);
		var pos = f.offset();
		e.html('<b>'+f.attr('alt').replace('|','</b><br>'));
		pos.top += f.outerHeight() -2;
		pos.left -= e.width()-22;
		e.show();
		e.offset(pos);
		e.offset(pos);
	});
	$('.ikony img').mouseout(function(){
		$('#hint').offset({top:0, left:0});
		$('#hint').hide();
	});
	
	
	
	$('.big').mouseover(function(){
		$(this).parent().animate( {backgroundPosition:"(0 128px)"}, {duration:600, complete: function(){
			$(this).css('background-image','none');}});
		$(this).hide(600,function(){
			$(this).nextAll('.counter').fadeIn(200);
		});
	});
	$('#showall a').click(function(){
		$('.big').mouseover();
		$(this).fadeOut(400);
		return false;
	});
	
	
	
	$('.more').toggle(function(){
		var e = $(this).parents('.projekt');
		e.stop().animate({height:270}, {duration:600});
		$(this).text('mniej...');
	}, function(){
		var e = $(this).parents('.projekt');
		e.stop().animate({height:112}, {duration:400});
		$(this).text('więcej...');
	});
	
	$('.light').lightBox({
		imageLoading: 'lightbox/lightbox-ico-loading.gif',
		imageBtnClose: 'lightbox/lightbox-btn-close.gif',
		imageBtnPrev: 'lightbox/lightbox-btn-prev.gif',
		imageBtnNext: 'lightbox/lightbox-btn-next.gif',
		imageBlank: 'lightbox/lightbox-blank.gif',
		txtImage: 'Zdjęcie',
		txtOf: 'z'
	});
});

