var VedjoLayout = $.Class.create({
	init: function()
	{
		this.cont = $("#projectsContainer");
		this.projects = $("#projectsContainer .b-project");
		this.projectsCount = this.projects.length;
		this.MIN_WIDTH = 300;
		this.WINDOW_DELTA = 44;
		this.update();
		this.cont.css({display:"block"}); 
		$(window).resize(this.update.bind(this));
	},
	
	update: function()
	{
		
				
		var cont_width = $(window).width()-this.WINDOW_DELTA;
		if(cont_width<960) return;
		
		var block_count = Math.floor(cont_width/this.MIN_WIDTH);

        if(block_count>this.projectsCount) block_count = this.projectsCount;
			
		var block_width = Math.round(cont_width/block_count)-1;
		this.projects.css({width: block_width+"px"});
		this.cont.css({width:cont_width+"px"});
			
	}
	
})

