function FormatNumber(expr, decplaces) {

var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces));

while (str.length <= decplaces) {
str = "0" + str;
}

var decpoint = str.length - decplaces;

return str.substring(0,decpoint) + "." + str.substring(decpoint, str.length);

}

function ShowRunningCart()
{
	document.write("<div id=showcart>");
	if (document.getElementsByTagName && GetCookie("Cart") && GetCookie("Cart") != "")
	{
		var CartStyle = "count|total";
		if (GetCookie("Cart"))
		{
			var cart = unescape(GetCookie("Cart"));
			if ( cart && cart != "")
			{
				var elems = cart.split("^");
				var items = elems[0].split("|");
	
				if (CartStyle.indexOf("count") > -1)
				{
					document.write(elems[1] + " item" + (parseInt(elems[1])>1 ? "s" : "") + ": ");
				}
	
				if (CartStyle.indexOf("items") > -1 )
	
				{
					for (i = 0; i < items.length; i++ )
					{
						document.write("<li>" + items[i] + "</li>");
					}
					document.write("<br>");
				}
	
				if (CartStyle.indexOf("total") > -1)
				{
					document.write("$" + FormatNumber(elems[2],2));
				}
			}
			else
			{
				document.write( "0 items : $0.00");
			}
		}
		else
		{
			document.write( "0 items : $0.00");
		}
	}
	else
	{
		document.write( "0 items : $0.00");
	}
	document.write("</div>");
}
ShowRunningCart();
