function tags_selector(div, hidden_div, field, var_name, label)
{
	var timer = null;

	this.show_full_tags = function()
	{
		if (!timer)
		{
			timer = setTimeout(var_name + ".show_full_tags_div();", 1500);
		}
	}
	
	this.show_full_tags_div = function()
	{
		kill_timer();
		div.style.display = "none";
		hidden_div.style.display = "block";
	}
	
	this.lose_focus = function()
	{
		kill_timer();
	}
	
	this.hide_full_tags = function()
	{
		kill_timer();
		timer = setTimeout(var_name + ".hide_full_tags_div();", 250);
	}

	this.hide_full_tags_div = function()
	{
		hidden_div.style.display = "none";
		div.style.display = "block";
	}

	this.append_tag = function(value)
	{
		label.hide_label();
	
		var tag_exists = new RegExp(value, "i");
		if (tag_exists.test(field.value))
			return false;			

		var comma_term_with_space = /^.*,(\s+)?$/;
		if ((field.value != '') && (!comma_term_with_space.test(field.value)))
			field.value = field.value + ', ';

		var comma_term_without_space = /^.*,$/;
		if (comma_term_without_space.test(field.value))
			field.value = field.value + ' ';

		field.value = field.value + value;
		adjust_field_height(field, 6);
	}
	
	function kill_timer()
	{
		if (timer) {
			clearTimeout(timer);
			timer = null;
		}
	}
}
