var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) &&
  (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) &&
  (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));
var is_ie = (agt.indexOf("msie") != -1);
var is_op = (agt.indexOf('opera')>-1);
var is_4up = (is_major >= 4);
function dispoi(qd) { for (t=0;t<displ.length;t++) if (qd<=displ[t]) return t; return displ.length; }
function dw(str) { document.write(str); } function sp(cla,str) { return "<span class=\"" + cla + "\">" + str + "</span>"; }
//cookie functions
function vCk(nm, vl) { if (gCk(nm)!=vl) if (nm=="cart") { alert(msgtroppiarticoli);
    cai = vl.split(seps); ca = cai[0]; for (i = 1; i<cai.length-1; i++) { ca += seps + cai[i]; }; sCk2("cart",ca);
  } else if (document.cookie.length) alert(msgerroreinterno+"\n\ncookie.length="+document.cookie.length+"\ncookie:"+nm+"="+vl.length); }
function sCk(nm, vl) { document.cookie = nm + "=" + escape(vl).replace(/\+/g,"%2B").substring(0,4020) + "; path=/"; vCk(nm, vl); }
function sCk2(nm, vl) { var oggi = new Date(); var muore = new Date(); muore.setTime(oggi.getTime() + 31536000000);
  document.cookie = nm + "=" + escape(vl).replace(/\+/g,"%2B").substring(0,4020) + "; expires=" + muore.toGMTString() + "; path=/"; vCk(nm, vl); }
function gCk(nm) { var se = nm + "="; if (document.cookie.length > 0) { ofs = document.cookie.indexOf(se); if (ofs != -1) { ofs += se.length; end = document.cookie.indexOf(";", ofs); if (end == -1) end = document.cookie.length;
  return unescape(document.cookie.substring(ofs, end)); } else return ""; } else return ""; }
function pun(vl) { while (vl.length<3) vl = "0"+vl; return sp("prez",euro+"&nbsp;"+ vl.substring(0,vl.length-2)+","+vl.substring(vl.length-2,vl.length)); }
function dwa(separator,link,text) { dw(separator + "<a href=\"" + link.replace(/\+/g,"%2B") + "\">" + text + "</a>"); }

prtot = 0; ordtot = 0; priva = (gCk("priva")=='x'); ordi1 = ''; ordi2 = ''; ordi3 = ''; ordi4 = ''; bolliniiperclub = 0; ord = gCk("ord"); if (ord=='') { ord='a'; sCk("ord","a"); nocookie=(document.cookie.length==0); } else nocookie=false; ca = gCk("cart"); acn = (''+gCk("acn")).split(seps); registrazione = false; lin = gCk("login");
sped = ""+gCk("sped"); if (sped=="") sped = "|"; sped = sped.split("|"); li = gCk("lang"); if (li=="") { li=(navigator.language? navigator.language : navigator.userLanguage).substr(0,2); // sCk("lang",li);
};
function Jiva(ce) { dw(msgmostraprezzi+(priva?msgivacompresa+" | <a href='javascript:sCk(\"priva\",\"\"); window.location.reload();'>"+msgivaesclusa+"</a>":"<a href='javascript:sCk(\"priva\",\"x\"); window.location.reload();'>"+msgivacompresa+"</a> | "+msgivaesclusa));
  dw(msgvisualizzainordine+(ord=="a"?msgsortalpha:"<a href=\"javascript:sCk2('ord','a'); window.location.reload();\">"+msgsortalpha+"</a>")+" | "+(ord=="p"?msgsortprice:"<a href=\"javascript:sCk2('ord','p'); window.location.reload();\">"+msgsortprice+"</a>")+" | "+(ord=="m"?msgsortmanu:"<a href=\"javascript:sCk2('ord','m'); window.location.reload();\">"+msgsortmanu+"</a>")
  +(ce==""?"":" | "+(ord=="i"?msgsortimpressions:"<a href=\"javascript:sCk2('ord','i'); window.location.reload();\">"+msgsortimpressions+"</a>")+" | "+(ord=="c"?msgsortcart:"<a href=\"javascript:sCk2('ord','c'); window.location.reload();\">"+msgsortcart+"</a>")+" | "+(ord=="o"?msgsortorders:"<a href=\"javascript:sCk2('ord','o'); window.location.reload();\">"+msgsortorders+"</a>"))); }
function JCart(co,de,prun,p5,p6,p7,p8,p9,p10) { dw("<td width='0'>"); pd = dispoi(p7); for (d=0;d<pd;d++) dw("<img src='/grafica/dispo.gif' alt='"+msgdisponibilita+":"+dispo[pd]+"'>"); dw("</td><td width='0' align='right'>"+sp("tc","Cod.")+co+"<br>"+pun((priva?prun+Math.round(prun*p10/100):prun).toString())+"/"+p6+"<br>"); dwa("","javascript:Jadd('"+escape(escape(co))+"','','','','',"+p7+","+p8+",'"+p9+"');","<img src=\"/grafica/microcarrello.gif\" border='0' alt=\""+msgaddtocart+"\">"+msgbuynow); dw("</td>"); }
function Jadd(co,de,p0,p1,p6,p7,p8,p9) { cai = ca.split(seps); noins = true; misure=p9.toUpperCase().split("X");
  for (i = 0; i<cai.length; i++) { caa = cai[i].split("|"); if (caa[0]==unescape(co)) { alert("Articolo già inserito nel carrello."); noins = false; }; }; if (noins) sCk2("cart", (ca.length?ca + seps:"")+unescape(co)+"|||||"+((misure.length==2)?misure[1]:1)+"||"+p7+"|"); window.location = "/incarrello.php?codice="+co; }
function Jfield(ce,na,va,si,cl,le) { return ce?sp(cl,va):"<input name='"+na+"' maxlength='"+le+"' value='"+va+"' size='"+si+(cl!=""?"' class='":"")+cl+"'>"; }
function JmostraU(ce,edurl) { dw((ce?'<a href="'+edurl+'">"+msgedit+"</a>':"")); }
function JmostraCe(ce) { return (ce?"":"<span class='er'>*</span>"); }
function JmostraC(ce) {
  if (acn.length<14) acn = ['','','','','','','','','','','','','',''];
  if (lin!="") acn[0] = (lin.split("|"))[0];
  if (!ce) {
    if (acn[0]=="") { dw(msgregistertitle);
    } else dw(msgregisteredittitle);
  };
  dw("<form name='daticliente' action='javascript:JcheckC("+ce+");'>"+(ce>1?"":"<span class='tc'>"+msgmandatoryfields+(ce==0?msgoptcookiefields:"")+"</span><br><br>")+
    (ce==0?"<table><tr><td align='right'>"+msguserid+"</td><td colspan='2' class="+(acn[0]==""?"'ba'>"+msgautouserid:"'lx'>"+acn[0])+"</td></tr>":
    "<input type='hidden' name='nomeutente' value='"+acn[0]+"'><table>"));
  if (registrazione) { 
    dw("<tr><td align='right'>"+msgusernick+"</td><td colspan='2'>"+Jfield(ce>1,'nick',acn[13],40,'bo',24)+"</td></tr>");
    if (lin!="") { acn[12] = (lin.split("|"))[1];
      if (ce<1) dw("<tr><td align='right'>"+msgcurrentpw+JmostraCe(0)+"</td><td colspan='2'>"+Jfield(0,"password' type='password","",10,'bo',16)+"</td></tr>"); };
    dw("<tr><td align='right'>"+msgnewpw+(acn[12]==""?"":msgleavepwblank)+": "+JmostraCe(ce>1)+"</td><td colspan='2'>"+Jfield(ce>1,"nuovapassword' type='password",(ce>1?"*****":""),10,'bo',16)+"</td></tr>");
    dw("<tr><td align='right'>"+msgconfirmpw+JmostraCe(ce>1)+"</td><td colspan='2'>"+Jfield(ce>1,"confermapassword' type='password",(ce>1?"*****":""),10,'bo',16)+"</td></tr>"); };
  dw("<tr><td align='right'>"+msgnameorbname+JmostraCe(ce>1)+"</td><td colspan='2'>"+Jfield(ce>1,'ragionesociale',acn[1],40,'bo',80)+"</td></tr>");
  dw("<tr><td align='right'>"+msgssnorvatno+JmostraCe(ce>1)+"</td><td colspan='2'>"+Jfield(ce>1,'cfopi',acn[2],40,'bo',16)+"</td></tr>");
  dw("<tr><td align='right'>"+msgaddress+JmostraCe(ce!=1)+"</td><td colspan='2'>"+Jfield(ce>1,'indirizzo',acn[3],40,'bo',120)+"</td></tr>");
  dw("<tr><td align='right'>"+msgpcodecityprovince+JmostraCe(ce!=1)+"</td><td colspan='2'>"+Jfield(ce>1,'cap',acn[4],5,'bo',6)+" "+Jfield(ce>1,'citta',acn[5],20,'bo',80)+" ("+Jfield(ce>1,'prov',acn[6],2,'bo',20)+")</td></tr>");
  dw("<tr><td align='right'>"+msgcountry+JmostraCe(ce!=1)+"</td><td colspan='2'>"+(ce>1?sp('bo','Italia'):"<select name='paese'>"+msgcountryoptions+"</select>")+"</td></tr>");
  dw("<tr><td align='right'>"+msgphone+JmostraCe(ce!=1)+"</td><td colspan='2'>"+Jfield(ce>1,'contatti',acn[7],40,'bo',80)+"</td></tr>");
  dw("<tr><td align='right'>"+msgemail+JmostraCe(ce>1)+"</td><td colspan='2'>"+Jfield(ce>1,'email',acn[8],40,'bo',80)+"</td></tr>");
  if (ce) { if ((ce<2)||(!registrazione)) { dest = gCk("dest"); if (dest=='') dest = "IDEM"; dw("<tr><td colspan='2'><br>&nbsp;</td></tr><tr><td align='right'>"+msgorderdest+JmostraCe(ce>1)+"</td><td colspan='2'>");
    if (ce>1) { dw("<pre class='de'>"+dest+"</pre>"); } else dw("<textarea name='destinatario'>"+dest+"</textarea>");
    dw("<tr><td colspan='2'><br>&nbsp;</td></tr><tr><td align='right'>"+msgcustomdata+"</td><td colspan='2'>");
    if (ce>1) { dw("<pre class='de'>"+altro+"</pre>"); } else dw("<textarea name='altro'></textarea>");
    dw("<tr><td colspan='2'><br>&nbsp;</td></tr><tr><td></td><td colspan='2'>");
    if (ce<=1) dw("<img src='grafica/iperclub.gif' /><br><input type='checkbox' name='iperclub'> "+msgiperclub1+bolliniiperclub+msgiperclub2);
    dw("</td></tr>"); }; if (ce<2) dw("<tr><td></td><td colspan='2'><input type='checkbox' name='memorizzazione' "+acn[10]+"> "+msgsaveordertocookie+"</td></tr>");
  } else
    dw("<tr><td align='right'>"+msgreceiveoffers+"</td><td colspan='2'>"+JmostraCe(ce!=1)+"<input type='checkbox' name='offerte' "+acn[9]+"> "+msgsendmeoffers+"</td></tr><tr><td align='right'></td><td colspan='2'>"+JmostraCe(ce!=1)+"<input type='checkbox' name='memorizzazione' "+acn[10]+"> "+msgsavetocookie+"</td></tr><tr><td align='right'>"+
      JmostraCe(ce>1)+"</td><td colspan='2'><input type='checkbox' name='consenso'> "+msgacceptprivacy+"</td></tr><tr><td colspan='3' align='center'><br><a class='bo' href='javascript:history.go(-1);'><img src='/grafica/cart2.gif' align='middle' border='0' alt='"+msgdontregister+"'></a> &nbsp; <a class='bo' href='javascript:Jregistra(1);'><img src='/grafica/cart6.gif' align='middle' border='0' alt='"+msgregister+"'></a>"+
      (acn[0]==""?"":"<a class='bo' href='javascript:Jregistra(0);'>&nbsp;&nbsp;<img src='/grafica/cart7.gif' align='middle' border='0' alt='"+msgremoveme+"'></a>")+
      "</form><form name='registra' method='post' action='/registra.php'><input type='hidden' name='email'><input type='hidden' name='nome'><input type='hidden' name='acn'></td></tr>"); dw("</table></form>"); }
function JcheckCP() { if ((acn[12]=="")||(!registrazione)) return true; if (acn[12].toUpperCase()==document.daticliente.password.value.toUpperCase()) return true;
  alert(msgcheckpw); return false; }
function JcheckCNP() { if (!registrazione) return true;
  if ((document.daticliente.nuovapassword.value.length<6)&&(document.daticliente.nuovapassword.value.length>0)||(document.daticliente.nuovapassword.value.length==0)&&(acn[12]=="")) {
    alert(msgpleasetypepw); return false;
  } else if (document.daticliente.nuovapassword.value!=document.daticliente.confermapassword.value) {
    document.daticliente.nuovapassword.value="";
    document.daticliente.confermapassword.value="";
    alert(msgpleaseconfirmpw); return false;
  } else return true; }
function JcheckD2() { if (registrazione) return false;
  return ((document.daticliente.destinatario.value.split("\n")).length>2); }
function JcheckC(ce) {
  if ((ce>-1)&&(document.daticliente.ragionesociale.value.length==0)) {
    alert(msgpleasetypename);
  } else if ((ce>-1)&&(document.daticliente.cfopi.value.length!=16)&&(document.daticliente.cfopi.value.length!=11)) {
    alert(msgpleasetypessn);
  } else if ((ce>0)&&((document.daticliente.indirizzo.value.length==0)||(document.daticliente.cap.value.length!=5)||(document.daticliente.citta.value.length==0)||(document.daticliente.prov.value.length!=2))) {
    alert(msgpleasetypeaddress);
  } else if ((ce==0)&&(document.daticliente.email.value.length==0)) {
    alert(msgpleasetypeemail);
  } else if ((ce>0)&&(document.daticliente.contatti.value.length==0)) {
    alert(msgpleasetypephone);
  } else if (JcheckD2()) {
    alert(msgdestaddress);
  } else if ((ce==0)&&(!document.daticliente.consenso.checked)) {
    alert(msgacceptmandatory);
  } else if (!JcheckCP()) {
  } else if (!JcheckCNP()) {
  } else if ((document.daticliente.ragionesociale.value+document.daticliente.cfopi.value+document.daticliente.indirizzo.value+document.daticliente.cap.value+document.daticliente.citta.value+document.daticliente.prov.value+document.daticliente.contatti.value+document.daticliente.email.value).indexOf("|")!=-1) {
    alert(msgillegalpipechar);
  } else {
    if (acn[12]!="") acn[0] = (lin.split("|"))[0];
    acn[1] = document.daticliente.ragionesociale.value;
    acn[2] = document.daticliente.cfopi.value;
    acn[3] = document.daticliente.indirizzo.value;
    acn[4] = document.daticliente.cap.value;
    acn[5] = document.daticliente.citta.value;
    acn[6] = document.daticliente.prov.value;
    acn[7] = document.daticliente.contatti.value;
    acn[8] = document.daticliente.email.value;
    if (ce==0) acn[9] = document.daticliente.offerte.checked?"checked":"";
    acn[10] = document.daticliente.memorizzazione.checked?"checked":"";
    acn[11] = acn[12];
    if (registrazione) { 
      acn[12] = document.daticliente.nuovapassword.value;
      acn[13] = document.daticliente.nick.value; };
    ordi3 = ((acn[0]!="")?'Registrato:'+acn[0]:'Non registrato')+'\n'+acn[1]+'\n'+acn[3]+'\n'+acn[4]+' '+acn[5]+' ('+acn[6]+')\nContatti:'+acn[7]+'\nCodice Fiscale/Partita IVA: '+acn[2];
    if (!registrazione) {
      if ((document.daticliente.destinatario.value.split("\n")).length==1) document.daticliente.destinatario.value += "\n";
      if (ce) sCk2("dest",document.daticliente.destinatario.value); };
    if (acn[10].length) sCk2("acn",acn.join(seps)); return -1; };
    if (ce==-1) return -1;
    return 0; }
function Jmostra(ce) { if (ca.length) {
    cai = ca.split(seps); dw((ce==0?"<table width='100%' border='0'><tr><td><h3>"+msgcarttitle+"</h3></td><td align='right'><a class='bo' href='javascript:history.go(-1);'><img src='/grafica/cart2.gif' align='middle' border='0' alt='"+msgcartcontinue+"'></a><br><br>"+msgcarthelp+"</td></tr></table><form name=\"carrello\" action=\"javascript:Jcheck();\">":
      "<h3>"+msgcartreview+numord+"</h3>"+sp("tc",msgcartreview1+sp("dr",numord)+msgcartreview2))+
      "<table border='0' class='noprint'><tr><td class='bv' colspan='2' valign='top'>"+msgcartcol[0]+"</td><td class='bv' align='right' valign='top'>"+msgcartcol[1]+"<br><span class='tc'>"+msgivaesclusa+"</span></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td width='0' class='bv'>"+msgcartcol[2]+
      (ce==0?"<br>"+msgcart0toremove:"")+"<br>"+msgavailability+"</td><td class='bv' align='right' valign='top'>"+msgcartcol[3]+"<br><span class='tc'>"+msgivaesclusa+"</span></td></tr>");
    ordi2 = "\nCodice|Descrizione|Qtà|UM|Netto Cad.|Tot.Imponibile|IVA 20%|Totale|Disponibilità\n";
    colli = 0; peso = 0; volume = 0; ivtot=0;
    for (i = 0; i<cai.length; i++) {
      caa=cai[i].split("|"); dwa("<tr><td colspan='2'>"+(caa[3].length?"<img onContextMenu=\"return false;\" src=\"foto/"+caa[3]+"\" border='0' alt=''><br>":""),"/cerca.php?codice="+escape(caa[0]),"<span class='tc'>Cod.</span>"+caa[0]);
      ordi2+=caa[0]+"|"+caa[1]+"|"+caa[5]+"|"+caa[6]+"|"+caa[2]/100+"|"+caa[2]*caa[5]/100+"|"+Math.round(caa[2]*caa[5]*caa[9]/100)/100+"|"+Math.round(caa[2]*caa[5]*(100+1*caa[9])/100)/100+"|"+dispog[dispoi(caa[7]-caa[5]+1)]+"\n";
      prtot+=caa[2]*caa[5]; ivtot+= Math.round(caa[2]*caa[5]*caa[9]/100); misure=caa[8].toUpperCase().split("X");
      if (misure.length==2) {
        collo=Math.ceil(caa[5]/misure[1]);
      } else if (misure.length==4) {
        collo=Math.ceil(caa[5]/misure[3]);
      } else
        collo=caa[5]*1;
      colli+=collo; peso+=Math.ceil(caa[4]*collo);
      if (misure.length>2) {
        volume += misure[0]*misure[1]*misure[2]/1000000*collo;
      } else
        volume += misure[0]*collo;
      dw("<br>"+caa[1]+"<br>&nbsp;</td><td align='right'>" + pun(caa[2]) + "</td><td></td><td>" + Jfield(ce,"qta"+i,caa[5],'3','bo',5)+" &nbsp; "+caa[6]+"<br>"+dispog[dispoi(caa[7]-caa[5]+1)]+"</td><td align='right'>"+pun((caa[2]*caa[5]).toString())+"</td></tr>");
    };
    csped = Math.round(cospe(peso,volume,sped[1]));
    assic = ''+gCk("assi");
    if (assic==1) {
      // costo d'acquisto, NON di vendita!
      pera = Math.round(assicperc[sped[1]]*prtot/100);
      if (pera<assicmin[sped[1]]) pera = assicmin[sped[1]];
      ordi2 += msgcartoptins+assicfranchperc[sped[1]]+"%|1||"+pera/100+"|"+pera/100+"|"+Math.round(pera*ivd/100)/100+"|"+Math.round(pera*(100+ivd)/100)/100+"|\n";
    } else pera = 0;
    sponda = ''+gCk("sponda");
    if (sponda==1) {
      pers = spondval[sped[1]];
      ordi2 += msgcartoptspeciald+"|1||"+pers/100+"|"+pers/100+"|"+Math.round(pers*ivd/100)/100+"|"+Math.round(pers*(100+ivd)/100)/100+"|\n";
    } else pers = 0;
    ordi1 = '\nTrasporto a mezzo:'+sped[0]+'\nAspetto: CARTONI\nColli:'+colli+'\nPagamento:';
    paga = ''+gCk("paga");
    if (paga==1) {
      perc = Math.round((prtot+pera+pers+csped) * 1.2 * contrperc[sped[1]] / (100 - 1.2 * contrperc[sped[1]]));
      if (perc<contrmin[sped[1]]) perc=contrmin[sped[1]];
    } else perc = 0;
    ordi1 += pagam[paga];
    bolliniiperclub = Math.ceil(prtot/100);
    ordi4 = '|Bollini Iperclub Vacanze|'+bolliniiperclub+"|PZ|0|0|0|0|1\n";
    dw("<tr><td colspan='4'></td><td>"+(ce==0?"<a class='bo' href='javascript:Jcheck();'><img src='/grafica/cart4.gif' align='middle' border='0' alt='"+msgcartqtychanged+"'></a>":"")+"<br>&nbsp;</td>");
    dw("<td align='right'>"+msgcarttotal+pun(prtot.toString())+"</td></tr><tr><td colspan='6'>"+((prtot>9999)?"":
      "<br><span class='er'>"+msgminord+"</span><br><span class='prez'>"+msgmaxordinfo+"</span>")+"<hr></td></tr>");
    dw("<tr><td colspan='5'>"+msgchoosecourier+((ce==0)?"<select name='spedizione' class='bv' onchange='sCk(\"sped\",document.carrello.spedizione.value); Jcheck();'>":""));
    for (i = 0; i<spedo.length; i++)
      dw((ce==0)?"<option value='"+spedo[i]+"'"+((i==sped[1])?" selected":"")+">"+spedg[i]:((i==sped[1])?sp("bo",spedg[i]):""));
    if (ce==0) { dw("</select>"); document.carrello.spedizione.value = sped.join("|"); };
    dw("</td><td align='right'>"+msgdeliverycost+pun(csped.toString())+"</td></tr>");
    dw("<tr><td colspan='5'>"+msgchoosepayment);
    if (ce==0) { dw("<select class='bv' name='pagamento' onchange='Jcheck();'>");
      for (formap=0;formap<pagam.length;formap++) dw("<option value='"+pagam[formap]+"'"+(paga==formap?' selected':'')+">"+pagam[formap]);
    } else dw(sp("bo",pagam[paga]));
    dw("</td><td align='right'>"+(paga==1?msgpondeliverycost+pun(perc.toString()):'')+"</td></tr>");
    ordi1 += '\nSconto:\nTrasporto:'+(csped/100).toString()+'\nSpese:'+(perc/100).toString();
//    dw("<tr><td colspan='5'><input type='checkbox' name='assicurazione' onclick='sCk(\"assi\",(document.carrello.assicurazione.checked?\"1\":\"\")); Jcheck();'>"+msgcartoptinsd+assicfranchperc[sped[1]]+
//      "%)</td><td align='right'>"+(assic==1?msgcartoptinscost+pun(pera.toString()):'')+"</td></tr>");
//    dw("<tr><td colspan='5'><input type='checkbox' name='sponda' "+((sponda==1)?"checked ":"")+"onclick='sCk(\"sponda\",(document.carrello.sponda.checked?\"1\":\"\")); Jcheck();'> "+msgcartoptspecialdd1+pun(spondval[sped[1]].toString())+
//      msgcartoptspecialdd2+"</td><td align='right'>"+(sponda==1?msgcartoptspecialdcost+pun(pers.toString()):'')+"</td></tr>");
    ivtot -=Math.round(prtot*ivd/100); ordtot = prtot; prtot+=csped+perc+pera+pers; iva = Math.round(prtot*ivd/100)+ivtot;
    dw("<tr><td colspan='5'></td><td align='right'><hr>"+msgcartgtotal+pun(prtot.toString())+msgcartvat+pun(iva.toString())+msgcartfinaltotal+pun((prtot+iva).toString())+"</td></tr>");
    ordi1 += '\nTot.Imponibile:'+(prtot/100).toString()+'\nTot.Ivato:'+((prtot+iva)/100).toString();
    prtot+=iva; dw("</table></form><table width='100%'><tr><td align='center'>"+"<img src='/grafica/cart5.gif' align='middle' border='0' alt='"+msgcartyourdatahere+"'>"+"</td>");
    if (ce==0) { dw("<td align='center'><a class='bo' href='javascript:sCk(\"cart\",\"\"); window.location = \"/carrello.html\";'><img src='/grafica/cart1.gif' align='middle' border='0' alt='"+msgcartclear+"'></a></td>");
      dw("<td align='center'><a class='bo' href='javascript:history.go(-1);'><img src='/grafica/cart2.gif' align='middle' border='0' alt='"+msgcartkeepbrowsing+"'></a></td></tr></table>"); } else dw("</tr></table>");
    JmostraC(1+ce);
    if (ce==0) { dw(msgcartfinalstatement+"<form name='checkout' method='post' action='/checkout.php'><input type='hidden' name='dati1'><input type='hidden' name='dati2'><input type='hidden' name='dati3'><input type='hidden' name='email'><input type='hidden' name='nome'><input type='hidden' name='dest'><input type='hidden' name='altro'><input type='hidden' name='acn'><input type='hidden' name='cart'></form>"); } else { dw("<table width='100%'><tr><td align='center'><a class='bo' href='/index.html'><img src='/grafica/cart2.gif' border='0' alt='"+msgcartkeepbrowsing+"'></a></td></tr></table>"); };
  } else dw(msgcartisempty); }
function JcheckP() {
  cai = ca.split(seps);
  ca = "";
  sCk2("paga",document.carrello.pagamento.selectedIndex.toString());
  for (i = 0; i<cai.length; i++) { var qta = 0;
    caa = cai[i].split("|");
    caa[5] = eval("document.carrello.qta"+i+".value");
    var misure = caa[8].toUpperCase().split("X");
    if (misure.length==2) {
      qta = Math.ceil(caa[5]/misure[1])*misure[1];
    } else if (misure.length==4) {
      qta = Math.ceil(caa[5]/misure[3])*misure[3];
    } else qta = caa[5];
    if (qta!=caa[5]) {
      caa[5] = qta;
      qta = eval("document.carrello.qta"+i+".value = "+qta);
    };
    if (caa[5]>0) ca = (ca.length?ca + seps:"") + caa.join("|");
  };
  sCk2("cart",ca); }
function Jcheck() { JcheckP(); if (JcheckC(-1)) window.location.reload(); }
function Jcheckout() { if (ordtot<minord) { alert(msgminord); return } if (JcheckC(1)) { if (document.daticliente.iperclub.checked==false) ordi4 = '';
  document.checkout.dati1.value = ordi1; document.checkout.dati2.value = ordi2+ordi4; document.checkout.dati3.value = ordi3; document.checkout.nome.value = document.daticliente.ragionesociale.value; document.checkout.email.value = document.daticliente.email.value; document.checkout.dest.value = gCk("dest"); document.checkout.acn.value = acn.join(seps); document.checkout.cart.value = ca; document.checkout.altro.value = document.daticliente.altro.value; document.checkout.submit(); }; }
function Jaccedi() { lin = document.accedi.utente.value+"|"+document.accedi.password.value; if (document.accedi.memorizzazione.checked) { alert(msgloginkeepalive); sCk2("login",lin); } else sCk("login",lin);
  if (document.accedi.password.value.toUpperCase()=="CAMBIALA") { alert(msgpleasechangepw); window.location = "/registrati.html"; } else if (registrazione) { window.location = "/"; } else window.location.reload(); }
function Jregistra(ce) { if (!ce) if (!confirm(msgconfirmremoval)) return; if (ce) if (!JcheckC(0)) return; if (ce) { document.registra.nome.value = document.daticliente.ragionesociale.value; document.registra.email.value = document.daticliente.email.value; }; document.registra.acn.value = acn.join(seps); document.registra.submit(); }
function JSel() { a = event.srcElement.nodeName; event.returnValue = ((a=='INPUT')||(a=='TEXTAREA')); return event.returnValue }
function Jlogout() { sCk("cart",""); sCk("login",""); window.location.reload(); }
