function blocksResizer(items, fixRazm, wh, plus, needCb)
{
	this.items=items;
	this.firstDiv=items.find(fixRazm);
	this.plus=plus;
	this.widthOwner=wh;
	this.needCb=needCb;

	this.lastItem=false;

	var self=this;

	this.init = function()
	{
		$(window).resize(function(){
			self.run();
		});
		self.run();
	};
	this.run = function()
	{
		
		var w=this.firstDiv.width()+plus;
		var ow=this.widthOwner.width();

		var inside=parseInt(ow/w);
		var saveins=inside;

		if(inside>this.items.length) inside=this.items.length;
		if(inside<saveins) inside=saveins;


		if(inside!=this.lastItem)
		{
			this.lastItem=inside;
			var newW=100/inside+"%";

			//alert(newW);

			this.items.css("width",newW);
			if(this.needCb)
			{
				var i=0;
				this.items.eq(0).parent().find(".cb").remove();
				this.items.each(function(){
					i++;
					if(i % inside==0) $(this).after("<div class='cb'></div>")
				});
			}
		};

	};
}
