sfHover = function() { if (!document.getElementsByTagName) return false; var sfEls1 = document.getElementById("nav").getElementsByTagName("li"); for (var i=0; i2) { restored=str.split(";"); for (i=0;i<(restored.length/2);i++) { zak[parseInt(restored[i*2])]=parseInt(restored[i*2+1]); } } str=ss.substring(ss.indexOf("{#end#}")+7,ss.length-1); if (str.length>2) { restored=str.split("|"); if (restored[0]!="") { for (i=0;i<(showfields.length-1);i++) { if (showfields[i]==restored[i*2] && showfields[i]!='payment') {document.forma2.elements[showfields[i]].value=restored[i*2+1]; } } } } } summa(); show(); } window.onload=restore_data; function createDescriptionField() { var s; s=""+ ""+ "
"+button("a", l_close, "close_info()")+"
data
"; return s; } function copy_info() { var ss; document.getElementById('tovary').innerHTML=createDescriptionField(); ss=window.dataframe.document.getElementById('description').innerHTML; ss=ss.replace(imgpath,infpath+"/"+imgpath); document.getElementById('description_data').innerHTML=ss; } function copy_page(a,l) { var ss; document.getElementById('tovary').innerHTML=window.dataframe.document.getElementById('content').innerHTML; document.getElementById("prilavok").style.display="block"; document.getElementById("oformit").style.display="none"; for (var i=1;i<=l;i++) {document.getElementById("smenu"+i).className="smenu"} document.getElementById("smenu"+a).className="smenuselected"; } function close_info() { show(); } function show_info(a) { obj=document.getElementById("div_description"); obj.innerHTML=createDescriptionField(); document.getElementById("description_data").innerHTML=" Loading..."; document.getElementById("tovary").innerHTML=""; window.dataframe.location.replace(a); } function get_var_from_str(sstr,svar) { ss=sstr.split("&"); res=""; for (i=0;i0 && reqfields[0].length!=0) { for (i=0;i<(showfields.length-1);i++) { if (reqfields[i]==1) {paynote=paynote + " " + namefields[i] + ": " + document.forma2.elements[showfields[i]].value; if (document.forma2.elements[showfields[i]].value.length<2) {y=1; str2=str2 + namefields[i] + ", ";}} } } if (y!=0) {str2=str2.substr(0,(str2.length-2)); alert (l_noemail + str2 + ".");} else { document.forma2.zak_pos.value=printable(); makePayments() ; document.getElementById('payment_loading').style.display='block'; if (clearcookie==2) {deleteCookie("rapidshop");} if (flag_pay_module=="url") { document.forma2.target=""; document.forma2.submit(); } else { document.forma2.target="dataframe"; document.forma2.submit(); setTimeout("document.forma_pay.submit()",1000); } } } function get_var(svar) { ss=document.location.href.split("&"); res=""; for (i=0;i*","");} else {return i}; } function formatCur(amount, znakov, delim) { var s,k; s=""; if (delim==undefined) { delim="";} amount=Math.round(amount*Math.pow(10,znakov))/Math.pow(10,znakov); if (znakov==2) { if (String(amount).indexOf(".")==-1) {str=amount+".00"} else {kp=(String(amount).length-String(amount).indexOf(".")); if (kp==2) {str=amount+"0"} else {str=amount} }; } if (znakov==1) {if (String(amount).indexOf(".")==-1) {str=amount+".0"} else {str=amount}; } if (znakov!=1 && znakov!=2) {str=amount;} str=String(str); k=-1;start=0; if (str.indexOf(".")==-1) {start=1;k=0;} for (var i=(str.length-1);i>=0;i--) { if (str.substr(i,1)==".") {start=1;} s=str.substr(i,1)+s; if (start==1) {k++; if (k==3 && i>0) {k=0;s=delim+s;}} } return s; } function convert_data() { min_summa=Number(min_summa);summa_dostavki=Number(summa_dostavki);tipskidki=Number(tipskidki); skidkakol1=Number(skidkakol1);skidkaval1=Number(skidkaval1);skidkakol2=Number(skidkakol2); skidkaval2=Number(skidkaval2);stepvar=Number(stepvar);tablewidth=Number(tablewidth); leftwidth=Number(leftwidth);rightwidth=Number(rightwidth);gnwidth=Number(gnwidth);gpwidth=Number(gpwidth); gkwidth=Number(gkwidth);idwidth=Number(idwidth);add2width=Number(add2width);photowidth=Number(photowidth); GrN=document.getElementById("GrNStr").innerHTML.split("|"); GN=document.getElementById("GNStr").innerHTML.split("|"); GText=document.getElementById("GTextStr").innerHTML.split("|"); reqfields=reqfieldsstr.split("|"); showfields=showfieldsstr.split("|"); namefields=namefieldsstr.split("|");paymentsname=paymentsnamestr.split("|"); znakov=znakov-1; for (var i=0;i<=GC;i++) { zak[i]=0; }; k=0; k2=0; for (var i=GrC+1;i>0;i--) { l=GrP[i]-GrP[i-1]; k=k+l; k2=k2+l; if (l==0) {GCount[i-1]=k; } else {GCount[i-1]=l; if (GrLevel[i-1]==-2) {k=0;}; if (GrLevel[i-1]==-1) {k=0; k2=0;}} } k1=0; k2=0; k3=0; for (var i=GrC+1;i>0;i--) { l=GrP[i]-GrP[i-1]; if (GrLevel[i-1]==-3) {k3=k3+l; GCount[i-1]=k3; k2=k2+l; k1=k1+l; k3=0; }; if (GrLevel[i-1]==-2) {k2=k2+l; GCount[i-1]=k2; k1=k1+l;k2=0;}; if (GrLevel[i-1]==-1) {k1=k1+l; GCount[i-1]=k1; k1=0;}; } m=0; str_test=""; for (var i=0; ii="+i+";GrLevel="+GrLevel[i]+";vlogen="+vlogen[i]; } vlogen[GrC]=-m; } function activateCart() { if (GrC!=-1) {while (GrP[curCat]==GrP[curCat+1]) {curCat++;}} window.name="shop"; category(curCat); } function insertContent(a,s) { if (document.getElementById(a)!=null) {document.getElementById(a).innerHTML=s;} } function createWS() { var s; document.getElementById("warning").style.display="none"; convert_data(); l=Math.floor((tablewidth-rightwidth-leftwidth)/gnwidth); if (tip_list==3) {stepvar=Math.round(stepvar/l)*l;gpwidth=gnwidth;idwidth=gnwidth;add2width=gnwidth;gkwidth=gnwidth;} if (tip_list==2) {stepvar=Math.round(stepvar/l)*l;idwidth=gnwidth;add2width=gnwidth;gpwidth=gkwidth;} insertContent("categories-container",createCategoriesList()); insertContent("search-container",createSearch()); insertContent("informer-container",cartInformer()); s=""+ ""; insertContent("content",s); } function PriceListButton() { var s; s=""+l_priceList+""; return s; } function createSearch() { var s; s=""+ "
"+l_search+"
"+ "
"+button("b", l_ok, "search()")+"
"; return s; } function createCategoriesList() { var s; s=""; ss=""; s+="
"+l_categories+"
"; return s; } function button(type,text,action,title) { if (type=="a") {return ""+text+""} else if (type=="b") {return ""} else if (type=="buybuttons") {return ""} } function makeCartResume() { var s,ss; ss="
"; s=zak_kolvo+" "+l_items+ss+l_total+" "+rubbefore+" "+formatCur(zak_summa,znakov,tToken)+rubafter+""; return s; } function cartInformer() { var s,ss; ss=""; s="
"+l_shopping_cart+ss; s+=""+makeCartResume(ss)+""+ss+ button("b", l_to_checkout, "checkout()")+ss+ button("a", l_viewcart, "viewCart()")+" "+button("a", l_clearcart, "clear_cart()")+ "
"; return s; } function make_client_info() { str="

"; for (i=0;i<(showfields.length-1);i++) { str=str + ""; } str=str+"
"+ ((reqfields[i]==1) ? "*": "") +namefields[i]+""; if (showfields[i]=='payment') { str=str + ""; } else {str=str + "";} str=str+"

"; return str; } function customerDetails() { var s; s="
"+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ "
"+l_yourorder+"
"+ l_rem1+"
_
"+ "

"+button("b", l_printable, "printOrder()")+ "

"+ ""+ ""+ ""+ "
"+l_deliverydata+"
"+ l_rem2+make_client_info()+ "
"+ "
"+ "
"+ button("b",l_returnhall, "razdel_num=0;show()")+ ""+ ""+ "payzone"+ "
"+ "
"+ "
"+ "
"; return s; } function summa() { zak_summa=0;zak_kolvo=0; for (var i=0;illast){s=""+GrN[k]+" / "+s;llast=GrLevel[k];} } } s=""+s+""; return s; } function pageTitle(a) {var s;s="
"+a+"
";return s;} function display(a) {pos=a;show();} function printRow(id,pp) { var nrow1,nrow1e,nrow2,nrow2e,photowidth2,b1,b2; str=""; nrow1=""; nrow1e=""; curalign=""; nrow2=""; nrow2e="";b1="";b2=""; if ((pp/2-Math.round(pp/2))==0 && tip_list==1) {k="chet"} else {k="nechet"}; if (tip_list==3) {curalign="text-align:center";photowidth2=gnwidth;} if (tip_list==2) {curalign="text-align:left";photowidth2=photowidth;} if (infon[id]==2 || infon[id]==3) {str01=""; str02="";} else {str01="";str02="";}; if (tip_list==3) {nrow2="";nrow2e=""; str+="
"; } if (tip_list!=1) {b1="
";b2="
"; str+=nrow2+""+nrow2e;} if (tip_list==2) {nrow1="";nrow1e="";str+=""; return str; } function show() { var curp,lastp; sShow=""; if (razdel_num==0) { if (search_on==0) {sShow=pageTitle(catTree(curCat))} else {sShow=pageTitle(l_searchresults+" "+poisk_str+"");} } else { sShow=pageTitle(l_shopping_cart); } sShow+="
"+str01+""+l_productdescription+""+str02+"
";} str+=nrow1+nrow2+""+nrow1e+nrow2e; if (show_product_id==2) {str+=nrow1+nrow2+""+nrow1e+nrow2e; } if (show_add_field2==2) {str+=nrow1+nrow2+""+nrow1e+nrow2e;} if (tip_list==2) {str+="
"+str01+GN[id]+str02+""+((tip_list!=1) ? l_ID : "")+" "+GKod[id]+""+GText[id]+"
";} str+=nrow1+nrow2+""+nrow1e+nrow2e; str+=nrow1+nrow2+""+nrow1e+nrow2e; if (tip_list!=1) {str+="
"+b1+rubbefore+formatCur(GP[id],znakov,tToken)+rubafter+b2+""+ ""+ ""; if (buy_button==2) { str+=""+button("buybuttons","+","plus("+ pp +")",l_addtocart); str+=button("buybuttons","-","minus("+ pp +")",l_cartout)+""; } else if (buy_button==1) { str=str+""; } str+="
"}; str=str+"
"; if (tip_list==3) {l=Math.floor((tablewidth-leftwidth-rightwidth)/gnwidth); m=0;} if (tip_list==1) {l=-2; sShow=sShow+""+(show_product_id==2 ? "":"") +(show_add_field2==2 ? "":"") +"";}; document.getElementById("cartResume").innerHTML=makeCartResume(); if (search_on==0) { if (razdel_num==0) { if (tip_sek==0) {end_sek=GrP[curCat+1]} else {end_sek=GC}; } else { start_sek=0; end_sek=zak_count; } } for (var i=pos; i<(pos+stepvar);i++) { m=m+1; nrow=""; if (tip_list==3) { if (m==l) {m=0; } else {nrow="";}; } if (search_on==0) { if (razdel_num==0 ) { if (i1) { s+="

"+l_page+" "; for (var i=1; i<=lastp;i++) { if (i==curp) {s+=""+i+" ";} else {s+=""+i+" ";} } sShow+="

"; } return s; } function category(a) { if (vlogen[a]==1) { if (document.getElementById("menu2p"+a).style.display=="none") {document.getElementById("menu2p"+a).style.display="block";} else {document.getElementById("menu2p"+a).style.display="none";} } else { curCat=a; search_on=0; document.getElementById("poisk_str").value=""; razdel_num=0; pos=GrP[curCat]; if (curCat==(GrC+1)) {pos=0; tip_sek=1;} else {tip_sek=0;} if (tip_sek==0) {end_sek=GrP[curCat+1]} else {end_sek=GC+1}; if (tip_sek==0) {start_sek=GrP[curCat]} else {start_sek=0}; show(); } } function clear_cart() { for (var i=0;i<=GC;i++) {zak[i]=0}; for (i=0;i<(showfields.length-1);i++) { if (showfields[i]!='payment') {document.forma2.elements[showfields[i]].value=""; } } razdel_num=0; show(); summa(); } function zaks_count() { zak_count=-1; zak_kolvo=0; for (var i=0;i<=GC;i++) { if (zak[i]!=0) { zak_count=zak_count+1; zak_kolvo=zak_kolvo+zak[i]; zak_index[zak_count]=i; } } } function symbols(s,r) { var ss; ss=""; for (var i=0;i
"+(show_product_id==2 ? "":"")+""; for (var i=0;i"+(show_product_id==2 ? "":"")+"";k=k+1; if (j==0) {ss="lightgrey";j=1;} else {ss="white";j=0;} } str=str + "" + (show_product_id==2 ? "":"") + ""; if (j==0) {ss="lightgrey";j=1;} else {ss="white";j=0;} } str=str + "
"+l_productname+""+l_productID+""+l_addTextField+""+l_productprice+""+((show_qty==2) ? l_quantity : "")+"
"+l_productname+""+l_productID+""+l_productprice+"
"+ symbols("---",(-GrLevel[k])-1)+" "+GrN[k] +"  
"+ symbols(" ",8)+ GN[i] +""+GKod[i]+""+rubbefore + formatCur(GP[i],znakov,tToken) + rubafter+"
"+l_contacts+"
"; prOrder=window.open(""); prOrder.document.write(str); prOrder.document.write(""); prOrder.document.close(); } function products_list() { var s; s="" + (show_product_id==2 ? "":"") + "\n"; for (var i=0;i<=zak_count;i++) { s+="" + (show_product_id==2 ? "":"") + "\n"; } s+="\n"; s+="\n"; s+="\n"+ "
"+l_productname+""+l_productID+" "+l_productprice+" "+l_quantity+" "+l_subtotal+"
"+ GN[zak_index[i]] +" "+GKod[zak_index[i]]+" "+rubbefore+ formatCur(GP[zak_index[i]],znakov,tToken)+rubafter+" "+ zak[zak_index[i]] +" "+rubbefore+ formatCur(GP[zak_index[i]]*zak[zak_index[i]],znakov,tToken)+rubafter+"
 "+l_subtotal+" "+zak_kolvo+" "+rubbefore+ formatCur(zak_summa,znakov,tToken) +rubafter+"
"+l_deliverycost+" "+rubbefore+formatCur(dost,znakov,tToken)+rubafter+"
"+l_discount+" "+rubbefore+document.forma2.discountsum.value+rubafter+"
"+l_total+" "+rubbefore + document.forma2.f2total.value+rubafter+ "
"; return s; } function printable() { str=""+l_yourorder+"
\n "; for (i=0;i<(showfields.length-1);i++) { str=str + "\n"; } str+="
"+namefields[i]+" "; if (showfields[i]=='payment') { str+=document.forma2.payment.options[document.forma2.payment.selectedIndex].text; } else { str=str + document.forms["forma2"].elements[showfields[i]].value; } str=str+"
\n"; str+=products_list()+"
"+l_contacts; return str; } function printOrder () { prOrder=window.open(""); prOrder.document.write(""+l_yourorder+""); prOrder.document.write(printable()); prOrder.document.close(); } function calc_delivery() { discountvalue=0; if (tipskidki==1) { if (zak_kolvo>=skidkakol1) {discountvalue=skidkaval1;} ; if (zak_kolvo>=skidkakol2) {discountvalue=skidkaval2;}} if (tipskidki==2) { if (zak_summa>=skidkakol1) {discountvalue=skidkaval1;} ; if (zak_summa>=skidkakol2) {discountvalue=skidkaval2;}} } function viewCart() { zaks_count(); if (zak_summa<=0) {alert (l_orderisnull)} else { search_off(); razdel_num=1; pos=0; show(); } } function checkout() { search_off(); zaks_count(); if (zak_summa<=0) { alert (l_orderisnull) } else { zak_str1="zak_str1="; zak_str2="zak_str2="; for (var i=0;i<=zak_count;i++) { zak_str1=zak_str1 + GN[zak_index[i]] + ":; Qty=" + zak[zak_index[i]] + ":; Price=" + GP[zak_index[i]]+ ":;;"; zak_str2=zak_str2 + GKod[zak_index[i]] + ":;" + zak[zak_index[i]] + ":;" ; } if (zak_count!=-1) {document.forma2.f2qty.value=zak_kolvo}; document.forma2.f2subtotal.value=formatCur(zak_summa,znakov,tToken); calc_delivery(); discountsum=zak_summa*discountvalue/100; document.forma2.discountsum.value=formatCur(discountsum,znakov,tToken); document.forma2.f2date.value=cur_date; if (tipcostdost==1) {dost=summa_dostavki} else if (tipcostdost==3) {dost=zak_kolvo*summa_dostavki} else {dost=zak_summa*summa_dostavki/100} if (zak_summa>=min_summa && min_summa!=-1) { dost=0; } document.forma2.f2delivery.value=formatCur(dost,znakov,tToken); document.forma2.f2total.value=formatCur(zak_summa+dost-discountsum,znakov,tToken); document.getElementById("spisok_tovarov").innerHTML="" + products_list(); document.forma2.zak_pos.value=printable(); if (oc==0) {if (document.getElementById("v"+"a").href.substring(9,11)=="pi" && document.getElementById("v"+"2").src.substring(10,12)=="id" && document.getElementById("v"+"2").height=="80" && document.getElementById("v"+"2").width=="100%") {} else {clear_cart();} } makePayments(); document.getElementById("prilavok").style.display="none"; document.getElementById("oformit").style.display="block"; } } function search() { poisk_str=document.getElementById("poisk_str").value; razdel_num=0; if (poisk_str!="") { search_count=0; for (i=0;i0) {per_package=GNum[id];} else {per_package=1;} if (GK[id]==0.01) {alert(l_quantity0);} else { if (prov_ogran_kolva==2) { if ((zak[id]+per_package)<=GK[id]) {zak[id]=zak[id]+per_package;} else { alert(l_maxquantity + GK[id]);} } else { zak[id]=zak[id]+per_package; } } document.getElementById("k"+a).value=zak[id]; summa(); } function minus(a){ var per_package; id=document.getElementById("id"+a).value; if ((GNum[id])>0) {per_package=GNum[id];} else {per_package=1;} if ((zak[id]-per_package)>=0) { zak[id]=zak[id]-per_package; } document.getElementById("k"+a).value=zak[id]; summa(); } function rukami(a) { id=document.getElementById("id"+a).value; if (isNaN(document.getElementById("k"+a).value)) {document.getElementById("k"+a).value=0;alert(l_notnumber);} if (Number(document.getElementById("k"+a).value)<0) {document.getElementById("k"+a).value=0;alert(l_negnumber);} zak_last=Number(document.getElementById("k"+a).value); if ((GNum[id])>0) {per_package=GNum[id];} else {per_package=1;} if ((zak_last/per_package)!=Math.round(zak_last/per_package)) {zak_last=per_package*Math.round(zak_last/per_package);} if (GK[id]==0.01) { alert(l_quantity0); } else { if (prov_ogran_kolva==2) { if (zak_last<=GK[id]) {zak[id]=zak_last;} else { alert(l_maxquantity + GK[id]);zak[id]=GK[id];} } else { zak[id]=zak_last; } } document.getElementById("k"+a).value=zak[id]; summa(); } function search_off(){search_on=0; document.getElementById("poisk_str").value="";poisk_str="";}