function my_patronages(box_id, delay, fade) {$smarty.ldelim}
	my_patronages_event(box_id, 1, delay, fade)();
{$smarty.rdelim}

function my_patronages_event(box_id, current, delay, fade) {$smarty.ldelim}
	return (function() {$smarty.ldelim}
		var i = 0;
		var active;
		$('#' + box_id).children().each(function(){$smarty.ldelim}
			i++;
			if (i == current) {$smarty.ldelim}
				active = this;
			} else {$smarty.ldelim}
				$(this).fadeOut(fade);
			}
		});
		
		if (current++ >= $('#' + box_id).children().length) {$smarty.ldelim}
			current = 1;
		}

		setTimeout(
			function() {$smarty.ldelim}$(active).fadeIn(fade)}, 
			fade*2
		);		
		setTimeout(
			my_patronages_event(box_id, current, delay, fade), 
			delay
		);
	{$smarty.rdelim});
{$smarty.rdelim}
