function showCart(){

var cookies=document.cookie;  //read in all cookies
var start = cookies.indexOf("ss_cart_" + serialNumber + "="); 
var cartvalues = "";
var linecount = 0;
var start1;
var end1;
var tmp;

if (start == -1)  //No cart cookie
{
  document.write("<span id=\"price\">$00.00<\/span>");
  document.write("<span id=\"items\">(0 items)<\/span>");
}
else   //cart cookie is present
{
  start = cookies.indexOf("=", start) +1;  
  var end = cookies.indexOf(";", start);  

  if (end == -1)
  {
    end = cookies.length;
  }

  cartvalues = unescape(cookies.substring(start,end)); //read in just the cookie data

  start = 0;
  var itemsHTML = '';
  while ((start = cartvalues.indexOf("|", start)) != -1)
  {
    start++;
    end = cartvalues.indexOf("|", start);
    if (end != -1)
    {
      linecount++;

      if (linecount == 2) // Total Quantity of Items
      {
        tmp = cartvalues.substring(start,end);
        colon = tmp.indexOf(":", 0);
         itemsHTML += "<span id=\"items\">(";
         itemsHTML += tmp.substring(colon+1,end - start);
        if ((tmp.substring(colon+1,end - start)) == 1 )
        {
          itemsHTML += " item";
        }
        else
        {
          itemsHTML += " items";
        }
        itemsHTML += ")<\/span>";
      }
     

      if (linecount == 3)  // Product Subtotal
      {
        tmp = cartvalues.substring(start,end);
        colon = tmp.indexOf(":", 0);
        document.write("<span id=\"price\">");
        document.write(tmp.substring(colon+1,end - start));
        document.write("<\/span>");
        
        document.write(itemsHTML)
      }

      start = end;
    }
    else
      break;
    }
  } // end while loop

  //close minicart HTML
}
/* end showCart() */

function fixSearchResults(){
	$$('.search-pipeline').each(function(element){
		if(element.next().nodeName == "DIV"){
			element.remove();
		}
	})
}
function initTabs(){
	$("tabs").select("li").each(function(l, i){
		if(i == 0){
			l.addClassName("active")
		}else{
			l.removeClassName("active")
		}
	})
	$("tabscontent").select("li").each(function(l, i){
		if(i == 0){
			l.show();
		}else{
			l.hide();
		}
	})	
}
function activateTab(li){
	li = $(li)
	var index = -1;
	$("tabs").select("li").each(function(l, i){
		if(l == li){
			index = i
			l.addClassName("active")
		}else{
			l.removeClassName("active")
		}
	})
	$("tabscontent").select("li").each(function(l, i){
		if(i == index){
			l.show();
		}else{
			l.hide();
		}
	})
}
