function listInit(){
	
	$('#work-list ul').width($(window).width());

	var criticalWidth = $(window).width() - $('#liner').width();
	
	$('.row2').removeClass('row2');
	
	var cumulativeWidth = 0;
	
	$('#work-list ul li').each(function(index){
	
		cumulativeWidth += $(this).width();
		
		//alert($(this).width() + ' - ' + cumulativeWidth);
		
		if(cumulativeWidth > criticalWidth){
		
			$(this).addClass('row2');
			
			return false;
			
		}
	
	});

}

$(document).ready(function(){

	listInit();
	
	$('#work-list ul li a').hover(function(){
		
		var fullSat = $(this).children('.full-sat');
		fullSat.stop();
		$(this).children('.project-title').stop();
		fullSat.parent().parent().css({zIndex : '30'});
		fullSat.animate({opacity : 1}, 300);
		$(this).children('.project-title').animate({bottom : '0px'}, 300, 'swing');
	
	},function(){
		
		var fullSat = $(this).children('.full-sat');
		fullSat.stop();
		fullSat.animate({opacity : 0}, 300);
		fullSat.parent().parent().css({zIndex : '20'});
		$(this).children('.project-title').animate({bottom : '-30px'}, 300);
	
	});
	
	$(window).resize(function(){
		
		listInit();
	
	});
	
});
