function TagCloud () {
	var THIS = this; //  when "this" is redefined, use "THIS" to access the properties
	//
	var list; // the <UL>, where the tags end up
	//
	
	function compareText(a, b) 
	{
		if (a.text > b.text) 
		{
			return 1;
		}
		if (a.text == b.text) 
		{
			return 0;
		}
		else 
		{ 
			return -1;
		}
	}
	
	this.addTags = function (tags) 
	{	
		if (tags.length > 0) {
			$('#content-sec').show();
			list.parent('.default-tag-cloud-content').find('.no-illtags').remove();
			list.parent('.default-tag-cloud-content').find('.loading-image').remove();	
			list.empty();

			// sort by text		
			
			tags.sort(compareText);
			
			// get maximum tag count (for the largest element)
			var maxTagCount = 0;
			var i;
			var tag;
			for (i = 0; i < tags.length; i++) {
				tag = tags[i];
				if (tag.count>maxTagCount) 
				{ 
					maxTagCount=tag.count;
				}
			}
					
			for (i = 0; i<tags.length; i++) {
				tag = tags[i];
				//	
				a = $('<a>' + tag.text + '</a>');
	//				.attr("href", "#")				
	//				.data("tag", tag)
	//				.click(function(event) {
	//					return false;
	//				})
	//				.mouseenter(function(event) {
	//					tooltip.show("tag", $(this).data("tag"));
	//				})
	//				.mouseleave(function(event) {
	//					tooltip.hide();
	//				});
				//
				li = $("<li></li>")
				.addClass("size-" + Math.floor(tag.count / maxTagCount * 3 + Math.min(1, tag.count / 1000) * 6))
				.append(a)
				.appendTo(list);
				//
				if (tag.highlight) {
					var bgColor = li.css("background-color");
					li
						.css("background-color", site.settings.highlight.color)
						.animate({
							backgroundColor: bgColor
							},
							site.settings.highlight.fadeTime
						);
					delete bgColor;
				}
			}
		} else {
			list.parent('.default-tag-cloud-content').find('.loading-image').remove();
			list.parent('.default-tag-cloud-content').find('.no-illtags').remove();
			list.parent('.default-tag-cloud-content').append('<p class="no-illtags">No illtags!</p>');
			list.empty();
		}
	};
	//
	this.construct = function (id) 
	{
		list = $('#' + id + '-list');
	};
}
console.log("tag-cloud.js");