function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + value +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

function cancella() {

	if (LANG == 0) {
		var choice = confirm("Sei sicuro di voler svuotare il carrello?");
	} else {
		var choice = confirm("Are you sure you want to empty the shopping cart?");
	}

	if (choice == true) {

		var VALORE_COOKIE = '0';
		var NOME_COOKIE = "Order";
		pathname = location.pathname;
		myDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';
		var largeExpDate = new Date ();
		largeExpDate.setTime(largeExpDate.getTime()+(365 * 24 * 3600 * 1000));
		SetCookie(NOME_COOKIE,VALORE_COOKIE,largeExpDate,myDomain);
		if (LANG == 0) {
			alert ("Il carrello è stato svuotato!");
			if (document.title == "Luciano Lazardi - Carrello" || document.title == "Luciano Lazardi - Composizione dell'ordine"){
				location.href="carrello.htm";
			}
		} else {
			alert ("The shopping cart is now empty!");
			if (document.title == "Luciano Lazardi - Shopping cart" || document.title == "Luciano Lazardi - Purchase order"){
				location.href="cart.htm";
			}
		}
	}
}

