var TotalCount=0; var TotalPrice=0; var newWin; function AddToCart(name,descr,price) { id2=id=parseInt(GetCookie('id')); id++; var argv = AddToCart.arguments; var argc = AddToCart.arguments.length; var idt = (argc > 3) ? argv[3] : id; var tmp=Math.abs(window.document.shtotal_form.shtotal.value.substr(0,window.document.shtotal_form.shtotal.value.length-4)); tmp+=Math.abs(price); tmp=parseInt(tmp*100)/100; window.document.shtotal_form.shtotal.value=tmp+' руб.'; var tmps='Ok'; SetCookie('test',tmps); var test=GetCookie('test'); if (test!=tmps) { window.open("added.php?not_work=true","w1","width=200; height=200"); return; } var some_n=8; var k=0; if (id>some_n) { for(var i=1;i<=some_n;i++) { if (!parseInt(GetCookie('count'+i))) { k++; for(var j=i;j'+GetCookie('name'+i); } function Price(i) { return GetCookie('price'+i); } function Total(i) { return GetCookie('count'+i) } function Summ(i) { var t=parseInt(Total(i)); var p=Price(i); var tmp=Math.floor(p*t*100)/100; TotalPrice+=tmp; TotalCount+=t; return(tmp); } function Remove(i) { newstr=CheckBox.replace("_NAME_","delcount"+i); newstr=newstr.replace("_VALUE_",i); newstr=newstr.replace("_CH_",""); return newstr; } function Update(n) { for (var i=1;i<=n; i++) { if (eval('window.document.f1.count'+i)) { SetCookie('count'+i,Math.abs(parseInt(eval('window.document.f1.count'+i+'.value')))); try { if (eval('window.document.f1.delcount'+i+'.checked')) { SetCookie('count'+i,0); } } catch(sss){} } } window.location.reload(); } function ViewCart() { var s=''; window.document.write(FormBegin); n=parseInt(GetCookie('id')); window.document.write(CartTableHeader); for (i=1;i<=n;i++) { if (parseInt(GetCookie('count'+i))!=0) { s+=''; for (j=0;j'; } s+=''; } } window.document.write(s+CartTableBottom); var tmp=Additional.replace("_UPDATEACTION_",'onclick="Update('+n+')"'); tmp=tmp.replace("_TOTALCOUNT_",TotalCount); tmp=tmp.replace("_TOTALPRICE_",Math.floor(TotalPrice*100)/100); window.document.write(tmp); window.document.write(FormEnd); }