var widthCurrent = 0;
var widthTotal = $('#navigation ul.ecsCatNav').width();
var itemsLen = $('#navigation ul.ecsCatNav>li').length;

$('#navigation ul.ecsCatNav>li').each(function() {
	widthCurrent += $(this).width();
});
$('#navigation ul.ecsCatNav>li').each(function() {
	$(this).width($(this).width() + (widthTotal - widthCurrent) / itemsLen);
});

// the browsers usually	round decimal, so real width is setup in a wrong way. Fixing:
if (!$.browser.mozilla) {
	var widthTotalReal = 0;
	$('#navigation ul.ecsCatNav>li').each(function() {
		widthTotalReal += $(this).width();
	});
	var lastWidth = $('#navigation ul.ecsCatNav>li:last-child').width();
	lastWidth = lastWidth + (widthTotal - widthTotalReal);
	$('#navigation ul.ecsCatNav>li:last-child').width(lastWidth);		
}

// mozilla has some problems with decimals
else if ($.browser.mozilla) {
	$('#navigation ul.ecsCatNav>li:last-child').css({
		'position':'absolute',
		'right':'0'
	});
}	

$('#navigation ul.ecsCatNav>li:last-child').addClass('lastItem');
$('#navigation ul.ecsCatNav>li:first-child').addClass('firstItem');

