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=showcart>");
	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("<div id=cartCount>" + elems[1] + "</div>");
			}

			if (CartStyle.indexOf("total") > -1)
			{
				document.write("<div id=cartTotal>$" + FormatNumber(elems[2],2) + "</div>");
			}
		}
	}
	document.write("<div id=cartView><a href=http://order.store.yahoo.net/cgi-bin/wg-order?yhst-39083765508394><img src=/lib/yhst-39083765508394/cartView.gif border=0></a></div>");
	document.write("<div id=cartCheck><a href=https://us-dc2-order.store.yahoo.net/ymix/MetaController.html?ysco_key_event_id=1&ysco_key_store_id=yhst-39083765508394&sectionId=ysco.ship-bill><img src=/lib/yhst-39083765508394/cartCheck.gif border=0></a></div>");
	document.write("</div>");
}
else 
{
	document.write("<div id=showcart2>");
	document.write("<div id=cartView><a href=http://order.store.yahoo.net/cgi-bin/wg-order?yhst-39083765508394><img src=/lib/yhst-39083765508394/cartView.gif border=0></a></div>");
	document.write("<div id=cartCheck><a href=https://us-dc2-order.store.yahoo.net/ymix/MetaController.html?ysco_key_event_id=1&ysco_key_store_id=yhst-39083765508394&sectionId=ysco.ship-bill><img src=/lib/yhst-39083765508394/cartCheck.gif border=0></a></div>");
	document.write("</div>");
}

