$(document).ready(function() {
  
   $('.thumb').each(function(i) {
		w = $(this).parent().width();
		f = Math.floor(w/120);
		nw = Math.floor((w-(f-1)*10)/f)-16;
		
		$(this).css('width',nw+'px');
		
			if(i==(f-1)){
				$(this).css('margin-right','0px');
			}
			if(i>(f-1)){
				$(this).css('margin-top','10px');
			}
		
  });
});
