	<script type='text/javascript'>
		[% IF reason == "post" %]
		function addTag(tagToAdd) {
			tagInput = document.getElementsByName('tags')[0];
			var tags = [];
			if (tagInput.value) tags = tagInput.value.split(/\s+/);
			for (i in tags) { if (tags[i] == tagToAdd) return; }
			tags = tags.concat(tagToAdd).sort();
			tagInput.value = tags.join(" ");
		}
		[% END %]
		var filter_below = 1;

		function refilter_tags() {
			taglist = document.getElementById('user_tags').getElementsByTagName('div');
			for (i = 0; i < taglist.length; i++) { 
				count = taglist[i].getElementsByTagName('span').item(0).firstChild.data;
				if (count < filter_below) { taglist[i].style.display = 'none' }
				else { taglist[i].style.display = '' }
			}
			update_filter_display();
		}

		function update_filter_display() {
			document.getElementById('filter_below').firstChild.data = filter_below;
		}

		function show_fewer(i) {
			if (filter_below < 100) {
				filter_below += i;
				if (filter_below > 100) filter_below = 100;
				refilter_tags();
			}
		}

		function show_more(i) {
			if (filter_below != 1) {
				filter_below -= i;
				if (filter_below < 1) filter_below = 1;
				refilter_tags();
			}
		}
	</script>

	<div class='taglist user' id='user_tags'>
	<h3>[% IF user==current_user %]your[% ELSE %][%user%]'s[% END %] tags</h3>
	<div style='text-align:center'>
		<span><a href='javascript:show_more(5)'>--</a></span>
		<span><a href='javascript:show_more(1)'>-</a></span>
		<span style='text-align:center' id='filter_below'>??</span>
		<span style='text-align:right'><a href='javascript:show_fewer(1)'>+</a></span>
		<span style='text-align:right'><a href='javascript:show_fewer(5)'>++</a></span>
	</div>
	[% FOREACH tag = user.tags_counted %]
	<div class='tag'>
		<span class='tag_count'>[% tag.1 %]</span>
		&nbsp;
		[% IF reason == "post" %]
		<a href='javascript:addTag("[% tag.0 %]")'>
		[% ELSE %]
		<a href='[% uri.entries(user => user, tags => [ tag.0 ]) %]'>
		[% END %]
			[% tag.0 %]
		</a>
		&nbsp;
	</div>
	[% END %]
	</div>
	<script type='text/javascript'> update_filter_display(); </script>
