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 getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}

if (getQueryVariable("Cart"))
{
  if (getQueryVariable("Cart") != "%5E0%5E0")
    SetCookie("Cart", getQueryVariable("Cart"));
  else
    DeleteCookie("Cart");
}

if (document.getElementsByTagName && GetCookie("Cart") && GetCookie("Cart") != ""  && GetCookie("Cart") != "%5E0%5E0")
{
	document.write("<div id=showcart2 onclick='location.href=\"http://order.store.yahoo.net/cgi-bin/wg-order?yhst-35028488036779\"' style='cursor:pointer;'>");
	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("There " + (parseInt(elems[1])>1 ? "are <font color=black>" : "is <font color=black>") + elems[1] + "</font> <img src=/lib/yhst-35028488036779/rcart-cart.gif align=absmiddle><br>item" + (parseInt(elems[1])>1 ? "s" : "") + " in your cart.<br>");
			}

			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("Total: <font color=black>$" + FormatNumber(elems[2],2) + "</font>");
			}
			document.write("<a href='https://us-dc2-order.store.yahoo.net/ymix/MetaController.html?ysco_key_event_id=1&ysco_key_store_id=yhst-35028488036779&sectionId=ysco.ship-bill'><img src=/lib/yhst-35028488036779/checkout-go.gif border=0 id=checkoutgo></a>");
		}
		else
			document.write("<br><center>Your cart is empty</center>");
	}
	else document.write("<br><center>Your cart is empty</center>");
	document.write("</div>");
}
else {
	document.write("<div id=showcart2 onclick='location.href=\"http://order.store.yahoo.net/cgi-bin/wg-order?yhst-35028488036779\"' style='cursor:pointer;'>");
	document.write("<center><br>Your cart is empty</center>");
	document.write("</div>");
}
