
function DisplayLogName(name) {
  var cookies=document.cookie;
  var start = cookies.indexOf(name + "=");
  var name = "";
  var start1;
  var end1;
  var tmp;
  var signed_in = -1;

  if (start != -1) {
    start = cookies.indexOf("=", start) +1;
    var end = cookies.indexOf("|", start);
    if (end != -1) {
      signed_in = cookies.indexOf("|yes", start);
      name = unescape(cookies.substring(start,end-1));
      document.write("Hello " + name);
      if (signed_in != -1) {
        document.write("    | <a href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?func=3&storeid=*28278f2bbb757f44c08ca4524cb97f0b0954dcec972c&html_reg=html\">Account</a>");
        document.write(" | <a href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?func=4&storeid=*28278f2bbb757f44c08ca4524cb97f0b0954dcec972c&html_reg=html\">Sign Out</a> | ");
      }
      else
      {
        document.write(" - Not Signed In | ");
      }
    }
  }
  if (signed_in == -1) {
    document.write(" <a href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?func=1&storeid=*28278f2bbb757f44c08ca4524cb97f0b0954dcec972c&html_reg=html\">Register</a>");
    document.write(" | <a href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?func=2&storeid=*28278f2bbb757f44c08ca4524cb97f0b0954dcec972c&html_reg=html\">Sign In</a> | ");

  }
}








function Start(page) {
OpenWin = this.open(page, "DetailWindow2", "toolbar=no,menubar=no,location=no,scrollbars=yes,resize=yes,height=600,width=300");
}


function DisplayMiniCart(name,style) {
  var cookies=document.cookie;  //read in all cookies
  var start = cookies.indexOf(name + "=");  //set start to beginning of ss_cart cookie
  var cartvalues = "";
  var linecount = 0;
  var start1;
  var end1;
  var tmp;

  // Start Output
  document.write("<div class=\"MiniCart\">\n");

  if (style == "Detail")
  {
    document.write("<table cellspacing=\"0\" cellpadding=\"0\" class=\"mcart\" width=\"100%\" bgcolor=\"#eeecce\" border=\"0\">\n");
    document.write("<tr>\n");
    document.write("<th colspan=\"3\">");
    document.write("<a href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?storeid=*26bb5ab5c4c7274c47e82420ccb7d0b79954bd9ebd&function=show\">");
    document.write("<img src=\"http://www.akitchen.com/store/media/themesmedia/cart-black.gif\" border=\"0\" name=\"cart\" align=\"top\"> <small>Your Shopping Cart</small>");
    document.write("</a></th></tr>");
  }
  else if (style == "Summary")
  {
    document.write("<a href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?storeid=*26bb5ab5c4c7274c47e82420ccb7d0b79954bd9ebd&function=show\">");
    document.write("Your Shopping Cart");
    document.write("</a>");
  }
  else
  {
    document.write("<a class=\"MiniCart\" href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?storeid=*26bb5ab5c4c7274c47e82420ccb7d0b79954bd9ebd&function=show\">");
    document.write("<img src=\"http://www.akitchen.com/store/media/themesmedia/cart-white.gif\" border=\"0\" name=\"cart\" align=\"top\">");
    document.write("</a>&nbsp;");
  }

  if (start == -1)  //No cart cookie
  {
    if (style == "Detail")
    {
      document.write("</table>\n");
    }
    else if ((style == "ItemCount") || (style == "Subtotal"))
    {
      document.write("<a href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?storeid=*26bb5ab5c4c7274c47e82420ccb7d0b79954bd9ebd&function=show\">");
      document.write("0 Items");
      document.write("</a>&nbsp;");
      document.write("</div>\n");
    }
    else
    {
      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++;

/* none of the styles use the number of line items
        if ((linecount == 1) && (style != "Detail"))  // Number of Line Items
        {
          tmp = cartvalues.substring(start,end);
          colon = tmp.indexOf(":", 0);
          if ((style == "ItemCount") || (style == "Subtotal"))
          {
            document.write("<a class=\"MiniCart\" href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?storeid=*26bb5ab5c4c7274c47e82420ccb7d0b79954bd9ebd&function=show\">");
          }

          if (style == "Summary")
          {
            document.write("<br>Contains <b>");
          } 
          document.write(tmp.substring(colon+1,end - start));
          if (style == "Summary")
          {
            document.write("</b>");
          }
          if ((tmp.substring(colon+1,end - start)) == 1 )
          {
            document.write(" Item");
          }
          else
          {
            document.write(" Items");
          }
          if (style == "ItemCount")
          {
            document.write("</a>");
          } 
          else if (style == "Subtotal")
          {
            document.write(": ");
          } 
          else if (style == "Summary")
          {
            document.write("<br>Sub Total: <b>");
          }
        }
*/

        if ((linecount == 2) && (style != "Detail"))  // Total Quantity of Items
        {
          tmp = cartvalues.substring(start,end);
          colon = tmp.indexOf(":", 0);
          if ((style == "ItemCount") || (style == "Subtotal"))
          {
            document.write("<a href=\"http://www.akitchen.com/cgi-akitchen/sb/order.cgi?storeid=*26bb5ab5c4c7274c47e82420ccb7d0b79954bd9ebd&function=show\">");
          }

          if (style == "Summary")
          {
            document.write("<br>Contains <b>");
          } 
          document.write(tmp.substring(colon+1,end - start));
          if (style == "Summary")
          {
            document.write("</b>");
          }
          if ((tmp.substring(colon+1,end - start)) == 1 )
          {
            document.write(" Item");
          }
          else
          {
            document.write(" Items");
          }
          if (style == "ItemCount")
          {
            document.write("</a>");
          } 
          else if (style == "Subtotal")
          {
            document.write(": ");
          } 
          else if (style == "Summary")
          {
            document.write("<br>Sub Total: <b>");
          }
        }




        if (linecount == 3)  // Product Subtotal
        {
          if ((style == "Subtotal") || (style == "Summary"))
          {
            tmp = cartvalues.substring(start,end);
            colon = tmp.indexOf(":", 0);
            document.write(tmp.substring(colon+1,end - start));
            if (style == "Summary") 
            {
              document.write("</b>");
            }
            else
            {
            document.write("</a>");
            }
          }
          else if (style == "Detail")
          {
            start1 = start;
            end1 = end;
            document.write("<tr><td><small>Qty</small></td>");
            document.write("<td><small>Product</small></td>");
            document.write("<td><small>Price</small></td></tr>\n");
          }
        }

        if ((linecount > 3) && (style == "Detail"))  // individual products
        {
          tmp = cartvalues.substring(start,end);
          colon = tmp.indexOf(":", 0);
          document.write("<tr>");
          document.write("<td><small>");
          document.write(tmp.substring(0,colon));
          document.write("</small></td><td><small>");
          colon2 = tmp.indexOf(":", colon+1);
          document.write(tmp.substring(colon2+1,end - start));
          document.write("</small></td><td><small>");
          document.write(tmp.substring(colon+1,colon2));
          document.write("</small></td></tr>\n");
        }
        start = end;
      }
      else
        break;
    } // end while loop

    //close minicart HTML
    if (style != "Detail")
    {
      document.write("</div>\n");
    }
    else
    {
      document.write("<tr>");
      document.write("<td colspan=\"2\">Subtotal</td>");
      document.write("<td>");
      tmp = cartvalues.substring(start1,end1);
      colon = tmp.indexOf(":", 0);
      document.write(tmp.substring(colon+1,end1 - start1));
      document.write("</td>");
      document.write("</tr>");
      document.write("</table>\n");
      document.write("</div>\n");
    }
  }
}
