function addToFavorits(id, type)
{
	if (id != "")
	{
		if (document.cookie.indexOf("cook_fav[" + id + "_" + type + "]") == -1)
		{
			var today = new Date()
			var expires = new Date();
			expires.setTime(today.getTime() + 1000*60*60*24*30);
			document.cookie = "cook_fav[" + id + "_" + type + "]=1; expires = " + expires.toGMTString() + "; path = /";
			var favorits_count = document.getElementById("favorits_count").innerHTML;
			favorits_count++;
			document.getElementById("favorits_count").innerHTML = favorits_count;
			alert("Товар занесен в корзину");
		}
		else
		{
			alert("Этот товар уже был ранее занесен в корзину");
		}

	}
}

function removeCurFromFavorits(id, type)
{
	if (id != "")
	{
		document.cookie = "cook_fav[" + id + "_" + type + "]=" + "" + "; expires =";
	}
}

function removeFromFavorits(id, type)
{
	if (id != "")
	{
		var today = new Date()
		var expires = new Date();
		expires.setTime(today.getTime() - 1000*60*60*24*30);
		document.cookie = "cook_fav[" + id + "_" + type + "]= ; expires =" + expires.toGMTString();
		document.all["fav_" + id + "_" + type].style.display = "none";

		document.all["basket_" + id + "_" + type].value = "";
		var favorits_count = document.getElementById("favorits_count").innerHTML;
		favorits_count--;
		document.getElementById("favorits_count").innerHTML = favorits_count;
		alert("Товар удален из корзины");
	}
}

