function viewCartItems(count){
	var action = new Cookie();
	action.setCookie("scCount", ""+count);
}

function showCartItems(){
	var count = getCartItemsCount();
	var ctrl = document.getElementById("shoppingcartitems");
	if (ctrl){
		if (ctrl.nodeName == "SPAN"){
			var msg;
			if (count == 0) { 
			  msg = "You have <font style=\"color:#333333\">no items</font> in your shopping cart";
			} else {
				if (count == 1) { 
					msg = "There is <a href=\"" + getUrlCart(logininfo_shoppingcart,0) + "\">1 item</a> in your cart.";
				} else {
					msg = "There are <a href=\"" + getUrlCart(logininfo_shoppingcart,0) + "\">" + count + " items</a> in your cart.";
				}
				msg += "<a href=\"" + getUrlCart(logininfo_checkout, 1) + "\" class=\"checkout\">Checkout</a>";
			}
			ctrl.innerHTML=msg;
		} else {
			ctrl.value=count;
		}
	}
}

function getCartItemsCount(){
	var action = new Cookie();
	var count = action.getCookie("scCount");
	if (count){
		return parseInt(count);
	} else {
		return 0;
	}
}

// retur
// -1 - http://, 0 - current, 1-https
function getUrlCart(path, mod){
  var loc = window.location.href;
  var ind=loc.indexOf("/", "http://".length + 1);
  if (ind<0)
	return loc + "/" + path;
  loc=loc.substring(0,ind) + "/" + path;
  if (mod == 0) { 
	return loc;
  } else 	if (mod == -1){
	return replace(loc,"https://", "http://");
  } else if (mod == 1){
	return replace(loc,"http://", "https://");
  } 
}

