var BlindEffect =
{
						measureItem: function(item)
	{
						var itemParent = item.parentNode;
		var measure = document.createElement("div");
		itemParent.appendChild(measure);

		measure.style.visibility = "hidden";
		measure.style.overflow = "hidden";
		measure.width = "1px";

		var clone = item.cloneNode(true);
		clone.style.display = "block";
		measure.appendChild(clone);

		var width = clone.offsetWidth;
		itemParent.removeChild(measure);

				return width + 2;
	},

	setOpacity: function(item, opac)
	{
		if ((navigator.appVersion.indexOf("MSIE")!= -1) && !window.opera)
			item.style.filter = "alpha(opacity=" + parseInt(opac * 100.0) + ")";
		else
			item.style.opacity = opac;
	},

	toggle: function(id)
	{
		var item = document.getElementById(id);
		if (item.timer)
						return;

		if (!item.offsetWidth || item.offsetWidth <= 1)
		{
			var expanding = true;
			var from_width = 1;
			var to_width = BlindEffect.measureItem(item);
			var from_opac = 0.0;
			var to_opac = 1.0;
			item.style.width = "1px";
			item.style.display = "block";
			item.style.overflow = "hidden";

		} else
		{
			var expanding = false;
			var from_width = item.offsetWidth;
			var to_width = 1;
			var from_opac = 1.0;
			var to_opac = 0.0;
		}

		var update_rate = 25;
		var duration = 1000.0;
		var d = new Date();
		var start_time = d.getTime();

		item.timer = window.setInterval
		(
			function()
			{
				var d = new Date();
				var passed_time = d.getTime() - start_time;

				if (passed_time >= duration)
				{
					if (expanding)
					{
						item.style.width = to_width + "px";

					} else
					if (!expanding)
					{
						item.style.width = "";
						item.style.display = "none";
					}

					window.clearInterval(item.timer);
					item.timer = null;
					BlindEffect.setOpacity(item, to_opac);

				} else
				{
					var t = Math.sin(passed_time / duration * Math.PI/2.0);
					var width = from_width + (to_width - from_width) * t;
					item.style.width = width + "px";
					BlindEffect.setOpacity(item, from_opac + (to_opac - from_opac) * t);
				}
				// if (window.CustomWidthForCountdowncontainer)
				//	window.CustomWidthForCountdowncontainer();
			},
			update_rate
		);
	}
}
