/**** Mini Cart Summary Display ****/

/**** REPLACE THE VALUES IN THESE LINES ****/
var serialnum="0001240372";
var cartURL="http://classicalpilates.net/cgi-bin/sc/order.cgi?storeid=*105f92130b0786900ecf&function=show";
var textColor="#2A5D9E";
var backgroundColor="transparent";
var showCart="no";       // only "yes" or "no"
var cartColor="black";    // only "black" or "white"
var textAlign="center";     // only "left" "right" or "center"

/**** DON'T CHANGE ANYTHING BELOW HERE ****/

var linkColor=textColor;
var cookies=document.cookie;  //read in all cookies
var start = cookies.indexOf("ss_cart_" + serialnum + "="); 
var cartvalues = "";
var linecount = 0;
var start1;
var end1;
var tmp;

// Start Output
document.write("<div id=\"minicart\" style=\"color:" + textColor + ";");
document.write("background-color:" + backgroundColor + ";");
document.write("text-align:" + textAlign + ";");
document.write("font-family: Verdana, Arial, Helvetica, sans-serif;");
document.write("font-size: 8pt;");
document.write("\">\n");
if (showCart == "yes")
{
  document.write("<a href=\"");
  document.write(cartURL + "\"");
  document.write(">");
  document.write("<img src=\"./media/themesmedia/cart-" + cartColor + ".gif\" border=\"0\" align=\"top\">");
  document.write("</a> ");
}

document.write("<a href=\"" + cartURL + "\" style=\"color:" + linkColor + "\">");
document.write("Your Shopping Cart");
document.write("</a>");

if (start == -1)  //No cart cookie
{
  //document.write("</div>\n");
}
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;
  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);
        document.write("<br>Contains <b>");
        document.write(tmp.substring(colon+1,end - start));
        document.write("</b>");
        if ((tmp.substring(colon+1,end - start)) == 1 )
        {
          document.write(" Item");
        }
        else
        {
          document.write(" Items");
        }
      }

      if (linecount == 3)  // Product Subtotal
      {
        tmp = cartvalues.substring(start,end);
        colon = tmp.indexOf(":", 0);
        document.write("<br>Subtotal: <b>");
        document.write(tmp.substring(colon+1,end - start));
        document.write("</b>");
      }

      start = end;
    }
    else
      break;
    }
  } // end while loop

  //close minicart HTML
document.write("<div id=\"view\">");
document.write("<a href=\"http://classicalpilates.net/cgi-bin/sc/order.cgi?storeid=*0e96f16b0e78100568&function=show\" rel=\"nofollow\"><img src=\"images/viewcart1.gif\" border=0></a>");
document.write("</div>\n");


document.write("</div>\n");

