function cart_update(t,i,q,jm10) { var f=getId('f_cart'); var inputs = f.getElementsByTagName('input'); var re = /[,]/gi; t.value=t.value.replace(re,'.'); if(t.value.toFloat()>q.toFloat() && i!=2) salert_mini('Wprowadzona ilość przez Ciebie jest niedostępna. Aktualny stan magazynowy dla tego produktu wynosi: '+q+'.','rc_warning'); if((t.value[t.value.length-1]!='.' && jm10=="true") || jm10=="false") { if(i==1 || i==3) { var re = /[^-10-9_.]/gi; var pid=t.id.replace(re,''); var pa=pid.split('_'); var v1=0; var pids=0; for(var i=0; i0 && jsonObj.discounts_code[0].msg==1) { salert(jsonObj.discounts_code[0].text,5000); } if(jsonObj.discounts_code[0].msg==1) { salert(jsonObj.discounts_code[0].text); } if($('sum_all')) getId('sum_all').set('html',jsonObj.sumall); if(typeof(jsonObj.prices)!='null' && typeof(jsonObj.prices)!='undefined') { jsonObj.prices.each(function(el){ var pr=el.price.split('_'); if($('pp['+el.pid+']')) $('pp['+el.pid+']').set('value',pr[0]); }); } if(jsonObj.discounts) set_discounts(jsonObj); if($('countries_t')) { shpping_ajax($('countries_t').get('value')); $('countries_t').dispose(); } else shpping_ajax($('countries').get('value')); } }).send(); } function check_discount(d) { loading_start(); var val='{RC}'; if(d) val=d.value; var req = new Request.JSON({ method: 'post', url: 'http://www.porcelana-cmielow.com/ajax/cart/discount/', data: {"dis":val,"max":getId('sum_all').innerHTML}, onComplete: function(jsonObj) { loading_stop(); if(jsonObj.discounts_code[0].value>0 && jsonObj.discounts_code[0].msg==1) { salert(jsonObj.discounts_code[0].text,5000); } if(jsonObj.discounts_code[0].msg==1) { salert(jsonObj.discounts_code[0].text); } getId('sum_all').set('html',jsonObj.sumall); set_discounts(jsonObj); shpping_ajax($('countries').get('value')); } }).send(); } function round(number,x) { number=number*100; var x = (!x ? 2 : x); var wynik=''; number=(Math.round(number*Math.pow(10,x)) / Math.pow(10,x))/100; wynik=Math.round(number*Math.pow(10,x)) / Math.pow(10,x) return wynik.toFixed(x); } function set_discounts(dis) { dis.discounts.each(function(d) { if($('pp['+d.pid+'_'+d.opt+']') && d.discount>0) { pb=$('pp['+d.pid+'_'+d.opt+']').get('value'); pb=parseFloat(pb).toFixed(2); npb=pb*(1-(d.discount/100)); npb=round(npb); $('dp['+d.pid+'_'+d.opt+']').set('html',npb+' '+dis.currency); $('dis['+d.pid+'_'+d.opt+']').set('html',d.discount+'%'); $('pri['+d.pid+'_'+d.opt+']').addClass('through'); $('pri['+d.pid+'_'+d.opt+']').set('html',pb+' '+dis.currency); $('sum_p['+d.pid+'_'+d.opt+']').set('html',(npb*$('item['+d.pid+'_'+d.opt+']').get('value')).toFixed(2)); } if($('pp['+d.pid+'_'+d.opt+']') && (d.discount==0 || d.discount=="")) { pb=$('pp['+d.pid+'_'+d.opt+']').get('value'); $('dp['+d.pid+'_'+d.opt+']').set('html',''); $('dis['+d.pid+'_'+d.opt+']').set('html','-'); $('pri['+d.pid+'_'+d.opt+']').removeClass('through'); $('pri['+d.pid+'_'+d.opt+']').set('html',pb+' '+dis.currency); $('sum_p['+d.pid+'_'+d.opt+']').set('html',(pb*$('item['+d.pid+'_'+d.opt+']').get('value')).toFixed(2)); } }); } function next_step(step) { window.location.href='http://www.porcelana-cmielow.com/_cart/step'+step+'/'; } function register() { var ve=getId('cart[email]').value; loading_start(); var req = new Request({ method: 'post', url: 'http://www.porcelana-cmielow.com/ajax/cart/email/', data: {"email":ve}, onComplete: function(data) { loading_stop(); var res = data; var r=res.split('~'); if(r[0]==1) next_step(3); else salert(r[1]); } }).send(); } function login() { var l=getId('cart[login]').value; var p=getId('cart[pass]').value; loading_start(); var req = new Request({ method: 'post', url: 'http://www.porcelana-cmielow.com/ajax/cart/login/', data: {"login":l,"pass":p}, onComplete: function(data) { loading_stop(); var res = data; var r=res.split('~'); if(r[0]==1) next_step(3); else salert(r[1]); } }).send(); } function invoice(t) { if(t.checked==true) getId('cart_invoices').style.display='block'; else getId('cart_invoices').style.display='none'; } function check_step3(f,term) { var s=true; var inputs = f.getElementsByTagName('input'); var password = new Array(); var p=0; for(var i=0; i=0 && mo<=sa) || mo.toString()=='NaN')) s=true; else { s=false; salert(mino) } if(r==0) { s=false; salert(shipping_text); } if(ap==13 && ''0) { var sh=parseFloat($('sh['+as+']').innerHTML); loading_start(); var req = new Request.JSON({ method: 'post', data:{"sh":sh}, async: false, url: 'http://www.porcelana-cmielow.com/ajax/cart/loyalty/', onComplete: function(jsonObj) { loading_stop(); s=jsonObj.valid; if(!s) salert(jsonObj.msg); } }).send(); } if(as==-4 && s_details!=1) { s=false; loading_start(); var rc_w=new rc_windows({ id:'rc_window12', container: $(document.body), useOverlay: true, width:600, height:400, move: true, title:'Komunikat', contentAJAX: 'http://www.porcelana-cmielow.com/ajax/cart/shiping_details/', varAJAX:{"sid":as,"ap":ap}, onComplete: function() { loading_stop(); var exV = new fValidator("f_details", { languageConfig:{l:{required:"To pole jest obowiązkowe! ",alpha:"Pole zawiera nie prawidłowe znaki! ",alphanum:"Pole zawiera nie prawidłowe znaki! ",integer:"Nieprawidłowe dane! ",real:"Nieprawidłowy numer! ",date:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateISO8601:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateEU:"Prawidłowy format daty to (mm/dd/rrrr)!) ",email:"Nieprawidłowy adres e-mail! ",phone:"Nieprawidłowy numer telefonu! ",url:"Nieprawidłowy adres URL! ",zip:"Nieprawidłowy format kodu pocztowego! ",confirm:"Nieprawidłowe hasło! "}}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "inpost_bt", fValidate_send:function(){ $('f_details').set('send', {onComplete: function(data) { if(data) { salert(data); close_overlay_out(0); } else { close_window_out($('rc_window12'),1); check_step1(f,mino,shipping_text,1) } }}).send(); } }); } }); } if(s) { var type='2'; if(type==1) f.submit(); var cust_id=0; if(''>0) cust_id=''; if(('370'==595 || '370'==1937) && type==2) { close_window_out($('rc_window1'),1); buy_type_set('g'); } else if(type==2 && '1'<4 && cust_id==0) { $(f.id).set('send', {onComplete: function(data) { var rc_w=new rc_windows({ id:'rc_window1', container: $(document.body), useOverlay: true, width:600, height:300, title:'KROK 2 z 5 - Logowanie', contentAJAX:'/ajax/cart/buy_type/', onComplete: function(){ var exV = new fValidator("f_login", { languageConfig:{l:{required:"To pole jest obowiązkowe! ",alpha:"Pole zawiera nie prawidłowe znaki! ",alphanum:"Pole zawiera nie prawidłowe znaki! ",integer:"Nieprawidłowe dane! ",real:"Nieprawidłowy numer! ",date:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateISO8601:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateEU:"Prawidłowy format daty to (mm/dd/rrrr)!) ",email:"Nieprawidłowy adres e-mail! ",phone:"Nieprawidłowy numer telefonu! ",url:"Nieprawidłowy adres URL! ",zip:"Nieprawidłowy format kodu pocztowego! ",confirm:"Nieprawidłowe hasło! "}}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "login_bt", fValidate_send:function(){ $('f_login').set('send', {onComplete: function(data) { var req = new Request({ method: 'post', url: 'http://www.porcelana-cmielow.com/ajax/cart/step3/', data:{"ajax_form_step":"ok"}, onComplete: function(data) { $('buy_type_content').set('html',data); loading_stop(); $('f_step3').set('send', {onComplete: function(data) { shiping_details(as); }}).send(); } }).send(); // }}).send(); } }); $('login').addEvent('keydown', function(event){if(event.key=='enter' && $('pass').get('value')!='') exV._onSubmit(event)}); $('pass').addEvent('keydown', function(event){if(event.key=='enter' && $('login').get('value')!='') exV._onSubmit(event)}); } }); }}).send(); } if(type==2 && '1'<4 && cust_id>0) { $(f.id).set('send', {onComplete: function(data) { var req = new Request({ method: 'post', url: 'http://www.porcelana-cmielow.com/ajax/cart/step3/', data:{"ajax_form_step":"ok"}, onComplete: function(data) { $('loading').set('html',data); loading_stop(); $('f_step3').set('send', {onComplete: function(data) { shiping_details(as); }}).send(); } }).send(); }}).send(); } if(type==2 && '1'>=4) $(f.id).set('send', {onComplete: function(data) { shiping_details(as); }}).send(); } } function shiping_details(t) { if(t==-5) { loading_start(); var ap=$('a_p').value; if($('rc_window1')) close_window_out($('rc_window1'),1); var rc_w=new rc_windows({ id:'rc_window12', container: $(document.body), useOverlay: true, width:600, height:400, move: true, title:'Komunikat', contentAJAX: 'http://www.porcelana-cmielow.com/ajax/cart/shiping_details/', varAJAX:{"sid":t,"ap":ap}, onComplete: function() { loading_stop(); var exV = new fValidator("f_details", { languageConfig:{l:{required:"To pole jest obowiązkowe! ",alpha:"Pole zawiera nie prawidłowe znaki! ",alphanum:"Pole zawiera nie prawidłowe znaki! ",integer:"Nieprawidłowe dane! ",real:"Nieprawidłowy numer! ",date:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateISO8601:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateEU:"Prawidłowy format daty to (mm/dd/rrrr)!) ",email:"Nieprawidłowy adres e-mail! ",phone:"Nieprawidłowy numer telefonu! ",url:"Nieprawidłowy adres URL! ",zip:"Nieprawidłowy format kodu pocztowego! ",confirm:"Nieprawidłowe hasło! "}}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "inpost_bt", fValidate_send:function(){ $('f_details').set('send', {onComplete: function(data) { if(data) { salert(data); close_overlay_out(0); } else { close_window_out($('rc_window12'),1); window.location.href='http://www.porcelana-cmielow.com/_cart/step4/'; } }}).send(); } }); } }); } else { if($('countries')) shpping_ajax($('countries').get('value')); window.location.href='http://www.porcelana-cmielow.com/_cart/step4/'; } } function sshipping(t,ni) { if($('cart_shipping')){ var sh=getId('cart_shipping'); var divs = sh.getElementsByTagName('div'); for(var i=0; i=0) { getId('finish_sum').innerHTML=ss.toFixed(2); if($('finish_vouchers_sum')) { var vouchers_sum=ss.toFixed(2)-($('finish_vouchers_sum_d').get('html')); if(vouchers_sum<0) vouchers_sum=0; $('finish_vouchers_sum').set('html',vouchers_sum.toFixed(2)); } } if(dic[1]>0) { var ssd=parseFloat(dic[0])+sh; getId('finish_sum').innerHTML=ssd.toFixed(2); getId('sum_discount_all').innerHTML=dic[3]+' '+dic[1]+''+dic[2]; } else getId('sum_discount_all').innerHTML=''; if($('payments['+sid+']')) if(getId('payments['+sid+']').value==1) { var payadd=parseFloat(getId('payadd['+sid+']').innerHTML); var payaddc=parseFloat(getId('payadd_curr['+sid+']').innerHTML); if (shh==0) { //payadd=0; } if (shhc==0) { //payaddc=0; } shhc=shhc+payaddc; shh=shh+payadd; } getId('shippingcost').value=shh; var sumall=getId('sumall').value; sumall=(parseFloat(sumall)+parseFloat(shh)) if(ss<100) { $$('select[id^=payments]').each(function(el,j){ for(i=0;i10000) { $$('select[id^=payments]').each(function(el,j){ for(i=0;i0) window.location.href='http://www.porcelana-cmielow.com/_cart/index/' else if(parseFloat(getId('sum_all').innerHTML)==0) $('shipping_ajax').set('html',''); else $('shipping_ajax').set('html',d[0]); if(d[2]!="") { if($('shipping_'+d[1])) { sshipping(getId('shipping_'+d[1]),1); bankacount(d[2],d[1]); } } else { if($('shipping_'+d[1])) { sshipping(getId('shipping_'+d[1]),1); bankacount(getId('payments['+d[1]+']').value,d[1]); } } checkbuy(); ajax_header_shopping_cart(); } }).send(); } function checkbuy() { sum1=$('sum_all').get('html'); if($('buybt')) { if(sum1==0) $('buybt').setStyle('display','none'); else $('buybt').setStyle('display','block'); } } function zagiel(amount,znr) { window.open('https://www.eraty.pl/symulator/oblicz.php?numerSklepu='+znr+'&wariantSklepu=1&typProduktu=0&wartoscTowarow='+amount, 'Policz_rate_zagile', 'width=630,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); } function lukas(amount,znr) { window.open('http://www.porcelana-cmielow.com/ajax.php?p=cart&f=lukas&type=s&amount='+amount, 'Policz_rate_lukas', 'width=800,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); } function grenke(amount,znr,pid,w) { window.open('http://www.porcelana-cmielow.com/ajax.php?p=cart&f=grenke&id='+znr+'&act=gen&amount='+amount+'&pid='+pid+'&w='+w, 'Policz_grenke', 'width=800,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); } function aig(amount,znr){ window.open('http://www.porcelana-cmielow.com/ajax.php?p=cart&f=aig&id='+znr+'&amount='+amount, 'Policz_rate_aig', 'width=800,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); } function buy_type_set(t) { var as=$('a_s').value; var req = new Request({ method: 'post', url: 'http://www.porcelana-cmielow.com/ajax/cart/buy_type_set/', data: {buy_type:t}, onComplete: function(data) { if(t=='g') tit='KROK 3 z 5 - Dane dostawy'; if(t=='r') tit='KROK 3 z 5 - Dane dostawy - Rejestracja'; var rc_w=new rc_windows({ id:'rc_window13', container: $(document.body), useOverlay: true, width:620, height:700, title:tit, contentAJAX:'/ajax/register/index/', varAJAX:{"pid":1,"item":1,"btype":1}, contentHTML: '/ajax/register/index/', onComplete: function(){ exV = new fValidator("f_register",{languageConfig:{l:{required:"To pole jest obowiązkowe! ",alpha:"Pole zawiera nie prawidłowe znaki! ",alphanum:"Pole zawiera nie prawidłowe znaki! ",integer:"Nieprawidłowe dane! ",real:"Nieprawidłowy numer! ",date:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateISO8601:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateEU:"Prawidłowy format daty to (mm/dd/rrrr)!) ",email:"Nieprawidłowy adres e-mail! ",phone:"Nieprawidłowy numer telefonu! ",url:"Nieprawidłowy adres URL! ",zip:"Nieprawidłowy format kodu pocztowego! ",confirm:"Nieprawidłowe hasło! "}}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "register_bt", fValidate_send:function(){ if(t!='g') var email=$('customers_email').get('value'); new Element('input',{name:'csrf',value:'rc',type:'hidden'}).inject($('f_register')); $('f_register').set('send', {onComplete: function(data) { close_window_out($('rc_window13'),1); shiping_details(as); }}); $('f_register').send(); } }); } }); } }).send(); } function orders_realize(){ loading_start(); var str=$('loading').getElement('strong'); str.set('html','Zamówienie jest w trakcie realizacji'); } periodicalid1=0; function change_address(v) { if(v=='a') tit='Adres dostawy'; if(v=='i') tit='Dane do faktury VAT'; var rc_w=new rc_windows({ id:'rc_window0', container: $(document.body), useOverlay: true, width:650, height:700, title: tit, type:'iframe', contentAJAX:'http://www.porcelana-cmielow.com/iframe.php?p=cart&f=step3a&type='+v, onComplete: function(){ periodicalid=overlay_corect.periodical(500,{ids:'rc_window0',lp:0}); if(periodicalid1>0) $clear(periodicalid1); } }); } function loyalty_info() { loading_start(); var rc_w=new rc_windows({ id:'rc_window11', container: $(document.body), useOverlay: true, width:400, height:300, move: true, title:'Komunikat', contentAJAX: 'http://www.porcelana-cmielow.com/ajax/cart/loyalty/', varAJAX:{"info":1}, onComplete: function() { loading_stop(); } }); } function loyalty_catalog() { loading_start(); var rc_w=new rc_windows({ id:'rc_window12', container: $(document.body), useOverlay: true, width:800, height:700, move: true, contentAJAX:'http://www.porcelana-cmielow.com/ajax/s/0/0/0/0/0/0/4/0/0/0/0/0/0/0/0/katalog.html', onComplete: function(){ $$('.rc_listing_setting').each(function(el,i){ el.dispose(); }); var listarr = $$('.rc_listing_number_site'); if(listarr.length>1) listarr.getLast().dispose(); loading_stop(); $$('.addcart').each(function(el,i){ var id=el.id.split('-'); var pid=id[1]; var ids=id[0].split('_'); var type=ids[2]; var ct=ids[3]; var rc_vs = new Fx.Slide('addcart_cont_'+ct+'-'+pid); rc_vs.hide(); el.addEvent('click', function(e){ e.stop(); $$('.addcart').each(function(el,i){ var id1=el.id.split('-'); var ids1=id1[0].split('_'); var pid1=id1[1]; if(pid1!=pid && ids1[3]==ct){ $('addcart_cont_'+ct+'-'+pid1).slide('out'); $('addcart_cont_'+ct+'-'+pid1).set('html',''); $('addcart_main_'+ct+'_'+pid1).setStyle('visibility', 'visible'); } }); }); pict=1; $(el).addEvent('click', function(e){ e.stop(); new Request({ method: 'post', url: 'http://www.porcelana-cmielow.com/ajax/pinfo/addcart/', data: {'pid':pid,type:type,item:$('products_quantity'+ct+'_'+pid).get('value'),ct:ct,pict:pict}, onComplete: function(data) { var d=data.split('~'); switch(d[0]) { case '1': case '2': if(type==0) tit='Dodawanie produktu do koszyka - wybór opcji'; if(type==1) tit=''; if(type==2) tit='Dodawanie produktu do koszyka - wybór opcji'; var rc_w=new rc_windows({ id:'rc_window_opt', container: $(document.body), useOverlay: true, width:600, height:300, title:tit, contentHTML:d[1] }); close_overlay_out(); $('rc_window_opt_body').set('html',d[1]); new Request({ method: 'post', url: "http://www.porcelana-cmielow.com/ajax/pinfo/inventory/", data: {'pid0':pid,pict:pict,'type':type}, onComplete: function(data) { $('inventory_opt_cont'+pict+'_'+pid).set('html',data); $('products_quantityopt_'+pid).set('value',$('products_quantity'+ct+'_'+pid).get('value')); } }).send(); break; default: $('addcart_cont_'+ct+'-'+pid).set('html',d[1]); rc_vs.slideIn(); //po wczytaniu do konca items_cart('products_quantity'+ct+'_'+pid,type,ct,pict); break; } } }).send(); }); }); } }); } window.addEvent('domready', function() { $$('#payments_type input').addEvents({ 'click': function() { loading_start(); var req = new Request({ method: 'post', url: 'http://www.porcelana-cmielow.com/ajax/cart/sig/', data: {pt:this.value}, onComplete: function(data) { $('ajax_payments').set('html',data) loading_stop(); } }).send(); } }); $$('#payments_type a').addEvents({ 'click': function() { loading_start(); var id=this.href.split("'"); var req = new Request({ method: 'post', url: 'http://www.porcelana-cmielow.com/ajax/cart/sig/', data: {pt:$(id[1]).get('value')}, onComplete: function(data) { $('ajax_payments').set('html',data) loading_stop(); } }).send(); } }); });