$(document).ready(function() {
	
	$('#nav > a:first').addClass('firstChild');
	$('#nav > a:last').addClass('lastChild');
	
	$('.productDesc tr td:even').addClass('tableIndex');
	$('.productDesc tr td:odd').addClass('tableValue');
	$('.tableIndex:last, .tableValue:last').css('border-bottom','0px');
	
	$('.textGallery a[rel], .regularsectionPhotos a[rel]').lightBox({
    	txtImage: 'Zdjęcie',
		txtOf: 'z'
    });
    
    
    
}
);

function centerImg(imgId,size,path){

	$('#' + imgId).css('display','block');
	$('#' + imgId).css('position','relative');
	
	var img = new Image();
	//img.onload = function() { 
	$(img).load(function(){
			
		var w = this.width; 
		var h = this.height;		
		
		if (w > h) {
		$('#' + imgId).css('width',size + 'px');
		//var nh = $(imgId).height();
		nh = Math.round((size * h)/w);
		var top = (size/2) - Math.round(nh/2);
		$('#' + imgId).css('top', top+'px');
		}
		else {
		$('#' + imgId).css('height',size + 'px');
		//var nw = $(imgId).width();
		nw = Math.round((size * w)/h);
		var left = (size/2) - Math.round(nw/2);
		$('#' + imgId).css('left', left+'px');
		}
			
	});
			
	img.src = path;	
}

