var TaggedItemsMenu = Class.create(Component, {

	tagItem: function (itemId){
		if (xajax.request({xjxfun: this.name + "AxTagItem"}, {parameters: [itemId], mode: "synchronous"}))
		{
			if ($("tagItemBtn" + itemId))
			{
				btn = $("tagItemBtn" + itemId).lastChild;
				btn.nodeValue = ($("tagItemBtn" + itemId).lastChild.nodeValue == "Tag Item" ? "Untag Item" : "Tag Item");
			}

			return true;
		}
		else return false;
	},

	unTagAllItems: function (itemId){
		if (xajax.request({xjxfun: this.name + "AxUntagAllItems"}, {mode: "synchronous"}))
		{
			var buttons = $$("a.tagItemButton");

			for (var i = 0; i < buttons.length; i++)
				buttons[i].lastChild.nodeValue = "Tag Item";

			if ($("ViewItemPage1:TagItem"))
				$("ViewItemPage1:TagItem").getElementsByTagName('a')[0].firstChild.data = "Tag Item";

			return true;
		}
		else return false;
	}

});


