$(function() {
	var margin = 17;
	var leftStart = 0;
	var left = leftStart;
	var list = $('#barPromoted ul');
	var first = list.children(':first');
	var firstWidth = first.width();
	var barWidth = $('#barPromoted').width();
	var width = 0;	
	
	list.children().each(function() {
		width += $(this).width() + margin;
	});
	
	if((multiply = Math.ceil(2 * barWidth / width)) > 1) {
		width *= multiply;
		children = list.children();
		for(ind = 1; ind < multiply; ind++) {
			children.each(function() {
				$(this).clone().appendTo(list);
			});
		}
	}
	
	list.width(width);
	list.everyTime(42, function() {
		left -= 2;
		if(left < -firstWidth - margin) {
			left += firstWidth + margin;
			first.appendTo(list);
			first = list.children(':first');
			firstWidth = first.width();
		}
		
		$(this).css('left', left + 'px');
	});
});
