$(document).ready(function () {
	$(window).on("load resize", function () {
		var min = 10000;
		var $contenitori = $(".gallery > div");
		$contenitori.each(function () {
			var $me = $(this);
			$me.css("height", "auto");
			var h = $me.height();
			if (h < min) {
				min = h;
			} 
		});
		$contenitori.height(min); 
	});
	
	$('.gallery a').colorbox({rel:'group'});
	
	$('.gallery > div > img').click(function(){
		var $img = $(this);
		var url = $img.attr('src');
		$.colorbox({href:url});
	});
});
