<!--VIEW_CART.js-->
<!--start-->
function view_cart() {
   mycookies=new Array(20);
   var i=0;
   var startpoint=0;
   whole_len=document.cookie.length;
   while(whole_len!=startpoint && i< 20)
   {
     if ((temlen=document.cookie.indexOf(";",startpoint))!=-1)
     {
	mycookies[i]=document.cookie.substring(startpoint,temlen);
	i++;
	startpoint=temlen+1
     }
     else if (startpoint != whole_len)
     {
        mycookies[i]=document.cookie.substring(startpoint,whole_len);
        i++;
        startpoint=whole_len;
     }
   }
    printtitle();
    for (j=0;j<i;j++)
     {
	getCookie(mycookies[j]);
     }
    document.write("</table>");
}


function getCookie (acookie) {
    clen = acookie.length;
    nlen= acookie.indexOf("=",0);

    //get rid of the "oops" at the beginning, thus start at 4
    if(acookie.substring(0,1)==" ")
       cname=acookie.substring(5,nlen);
    else
       cname= acookie.substring(4,nlen);
    bname= acookie.substring(nlen+1,clen);
    sname_len=cname.indexOf("+",0);
    store=cname.substring(0,sname_len);
    dlen=cname.indexOf("+",sname_len+1);
    descrip=cname.substring(sname_len+1,dlen)
    product=cname.substring(dlen+1,nlen);

    qlen=bname.indexOf("+",0);
    rlen=bname.indexOf("+",qlen+1);
    quant=bname.substring(0,qlen);
    if(quant==0)
	document.cookie="oops"+cname+"=bb; expires=Saturday, 16-Sep-90 23:59:59 GMT; path=/"+"";

    refer=bname.substring(qlen+1,rlen);
    price=bname.substring(rlen+1,clen-nlen);
    // Following step is for calculating the tax 
    if(product == '-');
    else  printcontent2();
   document.forms[0].ckproduct.style.visibility="hidden";
}

function putback(str1){
//alert(str1)
  document.cookie="oops"+str1+"=bb; expires=Saturday, 16-Sep-90 23:59:59 GMT; path=/"+""; 
}

// There's no need to touch anything above this line
// You can use "store","descrip","product","quant","price"
// and "refer" in the code below

function printtitle(){
//<td>Delete</td>
tabletitle="<table border=1><tr align=center> \
<td>product</td><td>description</td><td>Colour</td><td>quantity</td><td>price</td> \
<td>store name</td><td>Return product</td></tr>";
document.write(tabletitle);
}

function printcontent(){
  if(quant!=0){
  /*<td><input type=checkbox></td>*/
    document.write("<tr align=center><td><input type=hidden name=ckproduct>");
    document.write(product+"</td><td>");
    document.write(descrip+"</td><td>"+color+"</td><td>");
    document.write(quant+"</td><td>");
    document.write(price+"</td><td>"+"<a href="+refer+">"+store+"</a>");
    document.write("</td><td><form name=frmview><input type=submit value=return "); 
    document.write("onClick=\"putback(\'"+store+"+"+descrip+"+"+product+"+"+color);
    document.write("\')\"></form></td></tr>");
    document.forms[0].ckproduct.style.visibility="hidden";
   }
       document.forms[0].ckproduct.style.visibility="hidden";
}

//add a field so that shopper can change amount of product in cart
function printcontent2(){
  if(quant!=0){
  //<td><input type=checkbox></td>
    document.write("<tr align=center><td><input type=hidden name=ckproduct>");
    document.write(product+"</td><td>");
    document.write(descrip+"</td><td><form name=frmview method=get ");
    document.write("action=view_ww.html>");<!--http://www.weddingveil.com/-->
    document.write(color+"</td><td><input type=text size=3");
    document.write(" name=quantity value="+quant+">");
    document.write("<input type=hidden name="+price);
    document.write(" value=\""+descrip+"\">");
    document.write("<input type=hidden name=\""+product);
    document.write("\" value=\""+store+"\"></td><td>");
    document.write(price+"</td><td>"+"<a href="+refer+">"+store+"</a>");
    document.write("</td><td><input type=submit value=update onClick=");
    document.write("addto(this.form)>");
    document.write("</form></td></tr>");
    document.forms[0].ckproduct.style.visibility="hidden";
   }
       document.forms[0].ckproduct.style.visibility="hidden";
}

<!--end-->

