function shippingReception(sr_id) { loading_start(); if(sr_id=='' && getId('shipping_reception')) sr_id = getId('shipping_reception').get('value'); var req = new Request({ method: 'post', url: '/ajax/cart/shipping_reception/', data: {sr_id:sr_id}, onComplete: function(data) { if(getId('shipping_reception_desc')) getId('shipping_reception_desc').set('html',data); loading_stop(); } }).send(); } var timer = 1; function cart_update_3830(t,i,q,jm10) { clearTimeout(timer); timer=setTimeout(function validate(){ cart_update2_3830(t,i,q,jm10); },1000); } function cart_update2_3830(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(def.cart.no_quantity+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; iq.toFloat() && i!=2) salert_mini(def.cart.no_quantity+q+'.','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(jsonObj.discounts_code[0].value=="") { if($('discount')) { $('discount').set('value',''); } } } if($('sum_all')) getId('sum_all').set('html',jsonObj.sumall); if($('affix_sum_all')) getId('affix_sum_all').set('html',jsonObj.sumall); /* if($('delivery_time_days')) getId('delivery_time_days').set('html',jsonObj.max_delivery_time_days); */ 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 { if($('countries')) shpping_ajax($('countries').get('value')); } } }).send(); if(''>0) { loading_start(); var req = new Request.JSON({ method: 'post', data:{}, async: false, url: '/ajax//cart/repeat_orders/', onComplete: function(jsonObj) { loading_stop(); salert(jsonObj.msg); } }).send(); } } function check_discount(d) { loading_start(); var val='{RC}'; if(d) val=d.value; var req = new Request.JSON({ method: 'post', url: '/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 : parseInt(x)); var xToFixed = (!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(xToFixed); } function roundCzk(price,roundFactor){ if (price>0) { price=round(price,roundFactor); if(price==0){ price=1; } } return price; } function set_discounts(dis) { var j = 0; dis.discounts.each(function(d) { if($('pp['+d.pid+'_'+d.opt+']') && d.discount>0) { pb=$('pp['+d.pid+'_'+d.opt+']').get('value'); npb=parseFloat(pb*(1-(d.discount/100))); pb=parseFloat(pb).toFixed(2); var roundFactor = 2; if("".toLowerCase()=="czk"){ roundFactor = "0"; npb=roundCzk(npb, roundFactor); }else{ npb=round(npb, roundFactor); } npb=parseFloat(npb); pb=parseFloat(pb); if($('dpv['+d.pid+'_'+d.opt+']') && npb < pb) { var dpv = ((pb - npb)*$('item['+d.pid+'_'+d.opt+']').get('value')).toFixed(2) $('dpv['+d.pid+'_'+d.opt+']').set('html',dpv); } $('dp['+d.pid+'_'+d.opt+']').set('html',npb+' '+dis.currency); $('dis['+d.pid+'_'+d.opt+']').set('html',round(d.discount)+'%'); $('pri['+d.pid+'_'+d.opt+']').addClass('through'); $('pri['+d.pid+'_'+d.opt+']').addClass('old-price'); $('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($('ppw['+d.pid+'_'+d.opt+']')) { pbw=$('ppw['+d.pid+'_'+d.opt+']').get('value'); pbw=parseFloat(pbw).toFixed(2); npbw=pbw; npbw=round(npbw); $('sum_weight['+d.pid+'_'+d.opt+']').set('html',(npbw*$('item['+d.pid+'_'+d.opt+']').get('value')).toFixed(2)); } if($('pp['+d.pid+'_'+d.opt+']') && !d.discount) { if("" === "8942" || "" === "28261"){ var brutto = dis.prices[j].price.split('_'); $('pp['+d.pid+'_'+d.opt+']').set('value',brutto[0]); } pb=parseFloat($('pp['+d.pid+'_'+d.opt+']').get('value')).toFixed(2); $('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+']').removeClass('old-price'); $('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)); } j++; }); } function next_step(step) { window.location.href='https://glasweihnachtsschmuck.de/_cart/step'+step+'/'; } function register() { var ve=getId('cart[email]').value; var guest = 0; if(getId('guest')) guest = getId('guest').value; loading_start(); var req = new Request({ method: 'post', url: '/ajax//cart/email/', data: {"email":ve, "guest":guest}, 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 buyAsGuest() { if(getId('guest')) getId('guest').value = 1; register(); } function registerV4() { window.location.href = '/_cart/register/'; } function login(i) { if(i==0) { $('login_cart_bt').click(); return; } var l=getId('cart[login]').value; var p=getId('cart[pass]').value; loading_start(); var req = new Request({ method: 'post', url: '/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]+)>)/ig,""); sa=parseFloat(sa); var ap=$('a_p').value; var as=$('a_s').value; var r=0; $$('input[name=shipping]').each(function(el,j){ if(el.checked==true) r=1; }); // w v3 jest na select if(r == 0 && $('shipping') && $('shipping').get('value')) r = 1; if(((mo>=0 && mo<=sa) || mo.toString()=='NaN')) s=true; else { s=false; salert(mino) loading_stop(); } //if(r==0 && rc3type!=1) 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: '/ajax//cart/loyalty/', onComplete: function(jsonObj) { loading_stop(); s=jsonObj.valid; if(!s) salert(jsonObj.msg); } }).send(); } if(s) { var type=''; if(type==1 && rc3type!=1) { if((as == -5 || as == -4 || as == -6 || as == -7 || as == -8 || as == -10 || as == -11) && ($('shipping_details_chosen') && $('shipping_details_chosen').get('value')!=as) && dget('rcVer','sid',true)!=1072) shiping_details(as); else { f.submit(); return false; } } if(rc3type==1) { $('f_step1').set('send', {onComplete: function(data) { if(as == -5 || as == -4 || as == -6 || as == -7 || as == -8 || as == -10 || as == -11) shiping_details(as); else window.location.href='/_cart/step4/'; }}).send(); } var cust_id=0; if(''>0) cust_id=''; if((dget('rcVer','sid',true)==595 || dget('rcVer','sid',true)==1937) && type==2) { close_window_out($('rc_window1'),1); buy_type_set('g'); } else if(type==2 && ''<4 && cust_id==0 && rc3type!=1) { $(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:def.index.cart_buy_type, contentAJAX:'/ajax/cart/buy_type/', onComplete: function(){ var exV = new fValidator("f_login", { languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, 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: '/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 && ''<4 && cust_id>0 && rc3type!=1) { $(f.id).set('send', {onComplete: function(data) { var req = new Request({ method: 'post', url: '/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 && ''>=4 && rc3type!=1) $(f.id).set('send', {onComplete: function(data) { shiping_details(as); }}).send(); } } function callbackPP(a){ console.log(a); loading_start(); var req = new Request.JSON({ method: 'post', url: '/ajax/cart/shiping_details/', data:{"pni":a.pni,"sid": -4}, onComplete: function(data){ if($('shipping_details_chosen')) $('shipping_details_chosen').set('value', -4); check_step1(getId('f_step1')); loading_stop(); } }).send(); } function shiping_details(t) { var type=''; if(t==-5 || t==-8 || t==-10) //paczkomaty, balik na postu, balikomaty { 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:def.index.salert_defult, contentAJAX: '/ajax//cart/shiping_details/', varAJAX:{"sid":t,"ap":ap}, onComplete: function() { loading_stop(); var exV = new fValidator("f_details", { languageConfig:{ l:eval('({' + def.index.languages_fvalidator + '})') }, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "inpost_bt", fValidate_send:function(){ $('f_details').set('send', {onComplete: function(data) { data = new String(data).trim().toString(); if(data==2) { data=''; } if(data) { salert(data); close_overlay_out(0); } else { close_window_out($('rc_window12'),1); if($('shipping_details_chosen')) $('shipping_details_chosen').set('value', t); check_step1(getId('f_step1')); } }}).send(); } }); jQuery(window).trigger('shippingDetailsLoaded'); } }); } else if( == 2254 && t == -4) { var ap=$('a_p').value; var pobranie =0; if(ap==1)pobranie=1; PPWidgetApp.toggleMap(callbackPP,pobranie); } else if(t == 'blokada mapki') { var ap=$('a_p').value; var pobranie =0; if(ap==1)pobranie=1; PPWidgetApp.toggleMap(callbackPP,pobranie); }else if( t==-4 || t==-6 || t==-7 || t==-11) //eprzesyka { 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:def.index.salert_defult, contentAJAX: '/ajax//cart/shiping_details/', varAJAX:{"sid":t,"ap":ap}, onComplete: function() { if(t == -6 || t == -11) { if($('search_point')) $('search_point').addEventListener('keyup', function (e) { $('point').set('html',''); var val = $(this).get('value').toLowerCase(); if (val.length > 0) { $('point').set('disabled', ''); $$('#points > option').each(function (opt) { var str = $(opt).get('html').toLowerCase(); if (str.search(val) != - 1) { $(opt).clone().inject($('point')); } }) } else { $('point').set('disabled', 'disabled'); } var newPoint = $('point').clone(); newPoint.set('id', 'point') var fencySelect = jQuery('#point').parent(); var liElement = fencySelect.parent(); fencySelect.remove(); liElement.append(newPoint); jQuery('#point').removeClass('fancified'); jQuery('#point').fancySelect(); }) } jQuery(window).trigger('shippingDetailsLoaded'); if(t == -7) { $('inpost_bt').setStyle('display','none'); $('glob_search').addEventListener('click', function (e) { var req = new Request.JSON({ method: 'post', url: '/ajax/cart/shiping_details_search/', data:{"search":$('search_point').get('value')}, onComplete: function(data) { $('glob_search_result_info').set('html',''); if(data.status) { $('glob_search_result').set('html',''); $('inpost_bt').setStyle('display','block'); var status; var sel = new Element('select',{id:"global_point",name:"global_point"}); sel.addEventListener('change', function (e) { $$('[id^=global_info_]').each(function(el,i) { el.setStyle('display','none'); }); $('global_info_'+this.get('value')).setStyle('display','block'); $('point_info').set('value',$('global_info_'+this.get('value')).get('html')) }) data.points.each(function(el,i){ info=el.nazwa_marketingowa+'
'+el.ulica+' '+el.nr_dom+' '+el.nr_lokal+'
'+el.miasto+','+el.kod_pocztowy+'
'+el.wojewodztwo+'
'+el.godziny_otwarcia; status='none'; if(i==0) { status='block'; $('point_info').set('value',info); } info=el.nazwa_marketingowa+'
'+el.ulica+' '+el.nr_dom+' '+el.nr_lokal+'
'+el.miasto+','+el.kod_pocztowy+'
'+el.wojewodztwo+'
'+el.godziny_otwarcia; infodiv=new Element('div',{id:"global_info_"+el.id_partner_klienci,"html":info}).setStyles({'display':status,'text-align':'left'}); var newoption = new Option(el.miasto+','+el.kod_pocztowy+' - '+el.ulica+' '+el.nr_dom+' '+el.nr_lokal, el.id_partner_klienci); sel.add(newoption); infodiv.inject($('glob_search_result_info'),'inside'); }); sel.inject($('glob_search_result'),'inside'); //if(i==0) } else { $('inpost_bt').setStyle('display','none'); $('glob_search_result').set('html',data.error); } jQuery(window).trigger('shippingDetailsLoaded'); } }).send(); }) } loading_stop(); var exV = new fValidator("f_details", { languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "inpost_bt", fValidate_send:function(){ $('f_details').set('send', {onComplete: function(data) { data = new String(data).trim().toString(); if(data==2) { data=''; } if(data) { salert(data); close_overlay_out(0); } else { close_window_out($('rc_window12'),1); if(type==1) if($('shipping_details_chosen')) $('shipping_details_chosen').set('value', t); check_step1(getId('f_step1')); console.log(t); } jQuery(window).trigger('shippingDetailsLoaded'); }}).send(); } }); if(t == '-11'){ //jQuery(function(){ var city = ''; var street = ''; var home = ''; if($('address[customers_city]')){ city = $('address[customers_city]').get('value'); } if($('address[customers_street]')){ street = $('address[customers_street]').get('value'); } if($('address[customers_home]')){ home = $('address[customers_home]').get('value'); } var cashOnDelivery = null; if($('payments[-11]') && ($('payments[-11]').get('value')==1 || $('payments[-11]').get('value')==2)) cashOnDelivery = true; jQuery('#paczkaWRuchuMap').pwrgeopicker('inline', { 'form': { 'city': 'Warszawa', 'street': ' ' }, 'max_points': 100, 'popup': true, 'autocomplete': true, 'auto_start': true, 'CashOnDelivery': cashOnDelivery, 'onselect': function(data){ jQuery('#point').val(data.DestinationCode); jQuery('#paczkaWRuchuSelectedPointInfo').html(data.PSD + ' ' + data.City + ', ' + data.StreetName); jQuery('#paczkaWRuchuSelectedPoint').show(); jQuery('#inpost_bt').show(); } }); jQuery('#inpost_bt').hide(); //}) } jQuery(window).trigger('shippingDetailsLoaded'); } }); } else { //if($('countries')) //shpping_ajax($('countries').get('value')); window.location.href='https://glasweihnachtsschmuck.de/_cart/step4/'; } } function sshipping(t,ni) { $$('[id^=pay\[]').each(function(el,i) { el.setStyle('display','none'); $('1_'+el.get('id')).setStyle('display','none') }); $$('[id^=1_pay\[]').each(function(el,i) { el.setStyle('display','none'); }); if($('cart_shipping')) var sh=getId('cart_shipping'); if($('cart_shipping1')) var sh=getId('cart_shipping1'); var re = /[^0-9-3]/gi; var sid=t.value; if($('shipping_reception')) { if(sid=='-3') getId('shipping_reception').style.display='block'; } $('a_s').set('value',sid); if($('payments['+sid+']')){ $('a_p').set('value',getId('payments['+sid+']').value); bankacount(getId('payments['+sid+']').value,sid); getId('pay['+sid+']').style.display='block'; } getId('1_pay['+sid+']').style.display='block'; var sumaa=parseFloat(getId('sum_all').innerHTML); if(getId('sh['+sid+']')) sh=parseFloat(getId('sh['+sid+']').innerHTML); else sh = 0; if(isNaN(sh)) sh = 0; if(getId('shh['+sid+']')) shh=parseFloat(getId('shh['+sid+']').innerHTML); else shh=0; if(getId('shh_curr['+sid+']')) shhc=parseFloat(getId('shh_curr['+sid+']').innerHTML); else shhc=0; //payments_add if($('payments_add')) c_add=$('payments_add').get('html').toFloat(); else c_add=0; //payments_add end var ss=sumaa+sh+c_add; disc=getId('sum_discount').innerHTML dic=disc.split(','); if(getId('finish_sum_items')) getId('finish_sum_items').innerHTML=sumaa.toFixed(2); if(getId('finish_sum_shipping')) { if(isNaN(sh)) sh = 0; if(isNaN(c_add)) c_add = 0; getId('finish_sum_shipping').innerHTML=(sh + c_add).toFixed(2); } if(ss>=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;i 20000; } else { hide_caraty = ss < 500 || ss > 10000; } if(hide_caraty) { $$('select[id^=payments]').each(function(el,j){ for(i=0;i0) { window.location.href='https://glasweihnachtsschmuck.de/_cart/index/' } else if(parseFloat(getId('sum_all').innerHTML)==0) $('shipping_ajax').set('html',''); else if(d) $('shipping_ajax').set('html',d[0]); if(d) { 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]); } } if(getId('shipping')) { sshipping(getId('shipping'),1); if($('payments['+as+']')) bankacount(getId('payments['+as+']').value,d[1]); } } checkbuy(); ajax_header_shopping_cart(); if(typeof(jQuery) !== "undefined") { jQuery("body").trigger('cartShippingLoaded'); totalcart(); cart_account(); guestPayments(); } shippingReception(''); jQuery(document).trigger('shippingLoaded'); } }).send(); if(dget('rcVer','sid',true)==10180 || dget('rcVer','sid',true)==10364) { loading_start(); if($('discount')) var d=getId('discount'); var val='{RC}'; if(d) val=d.value; var req = new Request.JSON({ method: 'post', url: '/ajax//cart/sum/', data: {"id":"1","dis":val,"a_p":$('a_p').get('value')}, onComplete: function(jsonObj) { loading_stop(); if($('sum_all')) { getId('sum_all').set('html',jsonObj.sumall); var totalPriceElement = getId('total-price'); if (totalPriceElement) { totalPriceElement.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); } }).send(); } } function time_ajax(v) { loading_start(); var req = new Request({ method: 'post', url: '/ajax//cart/time_ajax/', data: {time_type:v}, onComplete: function(data) { loading_stop(); } }).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://glasweihnachtsschmuck.de/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('https://glasweihnachtsschmuck.de/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('https://glasweihnachtsschmuck.de/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: '/ajax//cart/buy_type_set/', data: {buy_type:t}, onComplete: function(data) { if(t=='g') tit=def.index.register_q; if(t=='r') tit=def.index.register_r; 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:eval('({' + def.index.languages_fvalidator + '})')}, 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(); if($('loading')) { var str=$('loading').getElement('strong'); str.set('html',def.index.order_realize); } } function orders_realize_s3830(){ //usuniete z V4 } function orders_realize_agb(){ var inputs = $('customers_agb'); if(inputs!==null && (inputs.type=='checkbox' && inputs.checked==false)){ salert('Proszę zaakceptować regulamin!'); return false; } loading_start(); if($('loading')) { var str=$('loading').getElement('strong'); str.set('html',def.index.order_realize); } return true; } periodicalid1=0; function change_address(v) { if(v=='a') tit=def.index.cart_window_ship; if(v=='i') tit=def.index.cart_window_inv; var rc_w=new rc_windows({ id:'rc_window0', container: $(document.body), useOverlay: true, width:650, height:700, title: tit, type:'iframe', contentAJAX:'https://glasweihnachtsschmuck.de/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:def.index.salert_defult, contentAJAX: '/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:'/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: '/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=def.index.window_opt_title; if(type==1) tit=def.index.products_list_box_title; if(type==2) tit=def.index.window_opt_title; 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: "/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(); }); }); } }); } function check_step3p(f,term) { var s=true; var inputs = f.getElementsByTagName('input'); var password = new Array(); var p=0; for(var i=0; i0) { var el1=$$('.cart-tick')[0] el1.setStyles({'visibility':'visible'}); el1.getParent('ul').addClass('selected'); } if($('add-new-invoice-form') && $('add-new-invoice-form').getElements('.cart-tick').length>0) { var el2=$('add-new-invoice-form').getElements('.cart-tick')[0]; el2.setStyles({'visibility':'visible'}); el2.getParent('ul').addClass('selected'); } $$('.address-row').addEvent('click', function(e){ Tick(this); }); } function Tick(t) { var el=t.getParent('[id^=add-new]'); if(el.get('id')=='add-new-address-form') $('add-new-address-form').getElements('.cart-tick').each(function(el){ el.setStyles({'visibility':'hidden'}); el.getParent('ul').removeClass('selected'); }); if(el.get('id')=='add-new-invoice-form') $('add-new-invoice-form').getElements('.cart-tick').each(function(el){ el.setStyles({'visibility':'hidden'}); el.getParent('ul').removeClass('selected'); }); t.getElement('i').setStyles({'visibility':'visible'}); t.addClass('selected'); setAddress(t); } function setAddress(t) { t.getElements('span').each(function(el){ if($('address['+el.get('data-address')+']')) $('address['+el.get('data-address')+']').set('value',el.get('html')); if($('invoice['+el.get('data-invoice')+']')) $('invoice['+el.get('data-invoice')+']').set('value',el.get('html')); }); } function eventNewAddress() { if($('new_address')) $('new_address').addEvent('click', function(e){ newAddress(); }); if($('choose_address_button')) $('choose_address_button').addEvent('click', function(e){ chooseAddress(); }); } function chooseAddress() { jQuery('#add-new-address-form').slideUp(); jQuery('#choose_address').slideDown(); $('addressType').set('value', 'chosen'); jQuery('#new_address').fadeIn(); jQuery('#choose_address_button').fadeOut(); $('submitChosenAddress').show(); $('submitNewAddress').hide(); } function newAddress() { jQuery('#add-new-address-form').slideDown(); jQuery('#choose_address').slideUp(); $('addressType').set('value', 'new'); jQuery('#new_address').fadeOut(); jQuery('#choose_address_button').fadeIn(); $('submitChosenAddress').hide(); $('submitNewAddress').show(); } function eventUseThisAddress() { $$('[class="address-radio"]').addEvent('click', function(){ useThisAddress($(this)); }) } function useThisAddress(selector) { clearAddressForm(); $('add-new-address-form').hide(); $('addressType').set('value', 'chosen'); $('submitChosenAddress').show(); $('submitNewAddress').hide(); $$('[class="address-row"]').removeClass('selected'); $$('[class="address-row"]').each(function(el){ if(el.get('data-id') == selector.get('id')) el.addClass('selected'); }); selector.addClass('selected'); } function clearAddressForm() { $$('[id^=address\[]').each(function(el){ el.set('value',''); }); $('c[customers_phone]').set('value',''); } // invoices function eventNewInvoice() { if($('new_invoice')) $('new_invoice').addEvent('click', function(e){ newInvoice(); }); } function newInvoice() { jQuery('#add-new-invoice-form').slideDown(); jQuery('#your-invoices').slideUp(); jQuery('#new_invoice').fadeOut(); $('invoiceType').set('value', 'new'); } function eventUseThisInvoice() { $$('[class="invoice-radio"]').addEvent('click', function(){ useThisInvoice($(this)); }) } function useThisInvoice(selector) { $('add-new-invoice-form').hide(); $('invoiceType').set('value', 'chosen'); $$('[class="invoice-row"]').removeClass('selected'); $$('[class="invoice-row"]').each(function(el){ if(el.get('data-id') == selector.get('id')) el.addClass('selected'); }); selector.addClass('selected'); } function eventChangeCountries() { if($('change_countries')) $('change_countries').addEvent('click', function(e){ ChangeCountries(); }); } function ChangeCountries() { $('countries-glow').removeClass('glow-generic'); var myFx = new Fx.Scroll($(document.body)).start(0,$('section-1').getCoordinates().top); $('countries-glow').addClass('glow-generic'); } function setCountries(t) { $$('.countries_name').set('html',t.options[t.selectedIndex].text) } function eventNewUserSlide() { if($('new_user_bt')) $('new_user_bt').addEvent('click', function(e){ NewUserSlide(); }); if($('customer_bt')) $('customer_bt').addEvent('click', function(e){ ValidUserSlide(); }); } function NewUserSlide() { if($('new_user_bt').get('data-status')==0) { var myFx = new Fx.Scroll($(document.body)).start(0,$('cart-register-form').getCoordinates().top); $('new_user_bt').set('data-status',1); } else $('new_user_bt').set('data-status',0); } function ValidUserSlide() { var myFx = new Fx.Scroll($(document.body)).start(0,$('cart-register-form').getCoordinates().top); } function eventRegisterType() { if(!$('register_type')) return; var rt=$('register_type').get('value'); var opt= new Array() if($('guest_email')) opt=$('guest_email').get('value').split('^'); if(rt==2) { $('customers_email').set('class',opt[0]); if($('guest') && $('guest').get('checked')) $('account-form').setStyles({'display':'block','opacity':1}) checkedGuest(true) if($('guest_div')) $('guest_div').setStyles({'display':'none'}); if($('cart_register_info')) $('cart_register_info').setStyles({'display':'none'}); } else { if (opt[1]=='true' && opt[2]=='true') { $('customers_email').set('class',opt[0]); } else { $('customers_email').set('class',''); if($('customers_emailajax_msg')) $('customers_emailajax_msg').dispose(); } if($('guest_div')) $('guest_div').setStyles({'display':'block'}); if($('cart_register_info')) $('cart_register_info').setStyles({'display':'block'}); } if($('guest_type').get('value')==1 && $('register_type').get('value')==1) { $('customers_email').set('class',opt[0]); if($('guest') && $('guest').get('checked')) $('account-form').setStyles({'display':'block','opacity':1}) if($('cart_register_info')) $('cart_register_info').setStyles({'display':'block'}); } $$('.register_types').each(function(el){ var type=el.get('data-id') if(rt!=type) { el.setStyles({'display':'none'}); el.getElement('input').disabled=true; } else { el.setStyles({'display':'block'}); el.getElement('input').disabled=''; } if(rt==1 && type==2) { var el1=el.getElement('input'); el1.set('class','') if($(el1.id+'required_msg')) $(el1.id+'required_msg').dispose(); } if(rt==2 && type==2) {console.log(775775); el.getElement('input').set('class','fValidate[\'required\']') } }); } function setRegisterType(t) { $('register_type').set('value',t.get('value')) eventRegisterType(); guestPayments(); } function backSlide() { if($('slide')) { var el=null; var slide=parseInt($('slide').get('value')); switch(slide) { case 1: el=$('section-1'); break; case 2: el=$('add-new-address-form'); break; case 3: el=$('add-new-address-form'); break; } if(el) { var myFx = new Fx.Scroll($(document.body)).start(0,el.getCoordinates().top); $('slide').set('value',0); } } } function guestPayments() { if($('shipping')) { if($('shipping')) var sid=$('shipping').get('value'); if($('payments['+sid+']')) var py=$('payments['+sid+']').get('value'); if($('guest_payments_'+py) && $('register_type').get('value')==1) { checkedGuest(true) if($('guest_div')) $('guest_div').setStyles({'display':'none'}); $('account-form').setStyles({'display':'block','opacity':1}) if($('cart_register_info')) $('cart_register_info').setStyles({'display':'none'}); } else { if($('register_type')) { if($('register_type').get('value')==1) { if($('guest_div')) $('guest_div').setStyles({'display':'block'}); } } } } } function checkedGuest(t) { if($('guest')) { $('guest').checked=t var parent=$('guest').getParent(); var na=parent.getElement('a') if(t==true) { if(na) na.addClass('checked') } else { if(na) na.removeClass('checked') } } } function setPassHelpEventCart() { if($("f_help_hc")){ var exV = new fValidator("f_help_hc", { languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "login_help_hc_bt", fValidate_send:function(){ $('f_help_hc').set('send', {onComplete: function(data) { salert(def.login.ok_pass,def.index.overlay_time,false,false,'none'); if($('rc_window2')) close_window_out($('rc_window2'),1,def.index.overlay_time); }}); $('f_help_hc').send(); } }); } } function r_sshipping(el, z) { switch($(el).get('name')) { case 'r_shipping': $('shipping').set('value', $(el).get('value')); sshipping($('shipping'),0); break; case 'r_payment': var shipping_id = $('shipping').get('value'); $('payments[' + shipping_id + ']').set('value', $(el).get('value')); sshipping($('payments[' + shipping_id + ']'),0); break; } } function selectIcon(icon) { var dataId = icon.get('data-id'); var dataValue = icon.get('data-value'); $$('.option-icon').each(function(el){ if(el.get('data-id') == dataId) el.removeClass('selected'); }); icon.addClass('selected'); $('options[' + dataId + ']').set('value', dataValue); } function changeOptions(element) { pid = jQuery(element).attr('data-id'); options = jQuery(element).attr('data-options'); var pict='fb'; jQuery.ajax({ method: "POST", url: "/ajax/cart/changeOptions/", data: { pid: pid, pict: pict, options: options, checkOptions:1 } }) .done(function(data) { var rc_w=new rc_windows({ id:'rc_window_opt', container: $(document.body), useOverlay: true, width:665, height:300, title:def.cart.change_option + ' ', contentHTML:data }); var type = 1; var val = {}; var optionArray = jQuery('#optionArray').html(); val = JSON.parse(optionArray); val['changeOption'] = 1; val['type'] = type; val['pict'] = pict; val['pid0'] = pid; val['pid'] = pid; jQuery.ajax({ method: "POST", url: "/ajax/pinfo/inventory/", data: val }).done(function(invData){ $('inventory_opt_cont'+pict+'_'+pid).set('html',invData); var price_type = 1; if($('price_type'+pict)) price_type = $('price_type'+pict).get('value'); amount_price(price_type,false,pict); if($('r_but')) $('r_but').getElements('table').setStyle('display','table'); }); }); } function sendChangeOptionsForm(pid,options,suff) { loading_start(); var ok = true; var s = true; text = ''; if(jQuery('#listing_msg')) jQuery('#listing_msg').html(''); var opt={}; var opts={}; var opts1=new Array(); opts1[0]={}; opts1[1]={}; var opts1s=new Array(); opts1s[0]={}; opts1s[1]={}; if(jQuery('#options_form'+suff)) { var sels = jQuery('#options_form'+suff).find('select'); for(var i=0; i