$(function(){
portfolio();

$(window).resize(function() {
	portfolio()
});
});

function portfolio(){
var teasers = $('#teasers div.portfolio');
var portfolio = $('#teasers');
var body = $('body');

if(body.width() < 1400){
	teasers.css({'width' : portfolio.width() * 0.226 + 'px', 'paddingRight' : portfolio.width() * 0.029 + 'px'});
	teasers.each(function(index){
		if ((index+1) % 4 == 0) $(this).css('paddingRight', '0');
		if (index < 8) $(this).show();
		else $(this).hide();
	});

} else{
	teasers.css({'width' : portfolio.width() * 0.175 + 'px', 'paddingRight' : portfolio.width() * 0.029 + 'px'});
	teasers.each(function(index){
		if ((index+1) % 5 == 0) $(this).css('paddingRight', '0');
		if (index < 10) $(this).show();
		else $(this).hide();
	});
}

}
