function loading_start_order() { var left=screen.width/2-300/2; var top=screen.height/2-200/2; if (window.pageYOffset != null) topy = window.pageYOffset; else if (document.body.scrollTop != null) topy = document.body.scrollTop; top=top+topy; getId('loading').style.display='block'; getId('loading').style.top=top+'px'; getId('loading').style.left=left+'px'; } function loading_stop_order() { getId('loading').style.display='none'; } function register_invoice(t) { if($('get_invoice').get('checked')==true) { if($('invoice_div')) { $('invoice_div').setStyle('display','block'); section=document.getElementById('invoice_div'); } else { section=document.getElementById('invoice-form'); } if(!section) return; inputs=section.getElementsByTagName('input'); for(var i=0; i=3) return; } //$$('.addcart').each(function(el,i){ // console.log('tu'); $$('.addcart:not(.ready)').each(function(el,i){ // console.log(el); $(el).addClass('ready'); var id=el.id.split('-'); var pid=id[1]; var ids=id[0].split('_'); var type=ids[2]; var ct=ids[3]; if($('addcart_cont_'+ct+'-'+pid)) { var rc_vs = $('addcart_cont_'+ct+'-'+pid); rc_vs.setStyle('display','none'); } el.addEvent('click', function(e){ // console.log(22); 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).setStyle('display','block'); $('addcart_cont_'+ct+'-'+pid1).set('html',''); $('addcart_main_'+ct+'_'+pid1).setStyle('visibility', 'visible'); } }); }); pict=1; $(el).addEvent('click', function(e){ e.stop(); // console.log(ct); // console.log(pid); if($('products_quantity'+ct+'_'+pid) && $('products_quantity'+ct+'_'+pid).get('value')!='' && $('products_quantity'+ct+'_'+pid).get('value')!=0) { if($('listing_msg')) $('listing_msg').dispose(); 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) { //console.log(data); if(!data) window.location.href='/p/0/'+pid+'/.html'; else { 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:700, height:300, title:tit, contentHTML:d[1] }); $('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')); if($('r_but')) $('r_but').getElements('table').setStyle('display','table'); } }).send(); break; default: $('addcart_cont_'+ct+'-'+pid).set('html',d[1]); //rc_vs.slideIn(); rc_vs.setStyle('display','block'); items_cart('products_quantity'+ct+'_'+pid,type,ct,pict); break; } } } }).send(); } }); }); } function change_stock_10651(obj) { var jQ = jQuery; stockArray = JSON.parse(jQ('#stockToOptions').html()); selectValue = jQ(obj).val(); data = selectValue.split(','); colorId = data[3]; sizeId = jQ(obj).attr('data-size-id'); if(selectValue == 0) { jQ('#sizeAvailability_'+sizeId).html(stockArray[sizeId]['stock']); } else { jQ('#sizeAvailability_'+sizeId).html(stockArray[sizeId]['stockToOption'][colorId]); } } function addToCart_10651(obj) { loading_start(); var jQ = jQuery; var pid = jQ(obj).attr('data-id'); var dataType = jQ(obj).attr('data-type'); var opt={}; var opts={}; var itemsToOpt={}; var suff=''; var s=true; var quantityInputs = jQ('#options_form').find('[id^=\'buy_quantity_\']'); var optionsQuantity = 0; jQ(quantityInputs).each(function(key,inputQuantity){ var items = jQ(inputQuantity).val(); if(items > 0) { var opt={}; var sizeId = jQ(inputQuantity).attr('data-size-id'); var colorSelectValue = jQ('#colorOptions\\['+sizeId+'\\]').val(); if(colorSelectValue == 0) { s = false; return false; } var sizeOptionId = jQ('#size_'+sizeId).attr('data-option-size-id'); var colorOptionId = jQ('#size_'+sizeId).attr('data-option-color-id'); var data = colorSelectValue.split(','); ++optionsQuantity; itemsToOpt[optionsQuantity] = items; opt[colorOptionId]=colorSelectValue; opt[sizeOptionId]=',,,'+sizeId; opts[optionsQuantity] = opt; } }); if(s==true) { var send = 0; for(i = 1; i <= optionsQuantity; ++i) { jQ.ajax({ type: 'POST', url: '/ajax/cart/index/', data: { products_id: pid, item: itemsToOpt[i], options: opts[i], ajax: 1, screenIinfo: screenIinfo }, async: false, }).done(function(data){ ++send; }); } if(optionsQuantity == send) { loading_stop(); if(optionsQuantity > 0) jQ('#options_form').submit(); } } else { jQ('#opt_error').show(); loading_stop(); salert_mini('Proszę wybrać odpowiedni wariant produktu!','warning'); } } function rc_event_add_product_to_cart(suffix, selected_item_count, products_id) { return new Promise(function (resolve, reject) { var products_options_parsed = getProductOptions(suffix); var products_options = products_options_parsed.data.map(function (value) { return { options_values_id: value.id }; }); if (!window.fetch) { return resolve('fetch not defined'); } fetch('/ajax.php?p=conversion&f=products_info&ssl=1', { method: 'POST', body: JSON.stringify({ products: [{ products_id: products_id, item: selected_item_count, options: products_options }] }), credentials: 'same-origin', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } }) .then(function (response) { return response.json() }) .then(function (response) { response.products.forEach(function (product) { window.jQuery && jQuery(document.body).trigger('rc_event_add_product_to_cart', product); console.log('rc_event_add_product_to_cart', product); }); resolve(); }).catch(resolve); }); } function add_cart_pinfo_new() { $$('.pinfo-to-cart').each(function(el,i){ el.addEvent('click', function(e){ if($('listing_msg')) //$('listing_msg').set('html',''); $('listing_msg').innerHTML = ''; var pid=this.get('data-id'); var dataType=this.get('data-type'); if(647==13293 && jQuery('#opt_box_error')) { jQuery('#opt_box_error').removeClass('incorrect_border'); } if(647 == 12120 && parseInt(jQuery(window).width()) < 830) { dataType = 'false'; } var opt={}; var opts={}; var opts1=new Array(); opts1[0]={}; opts1[1]={}; var opts1s=new Array(); opts1s[0]={}; opts1s[1]={}; var suff=''; var s=true; if($('options_form'+suff)) { var sels = $('options_form'+suff).getElementsByTagName('select'); for(var i=0; i0) item=$(itemn).get('value'); var pict='fb' new Request({ method: 'post', url: '/ajax/pinfo/addcart/', data: {'pid':pid,item:item,pict:pict, checkOptions:1}, onComplete: function(data) { if(!data) window.location.href='/p/0/'+pid+'/.html'; else { var d=data.split('~'); switch(d[0]) { case '1': case '2': if('647'=='3815') { var photo = jQuery('.product-photo[data-id="' + pid + '"]')[0]; var photoPosition = photo.getPosition(); var x = photo.getPosition().x; var y = photo.getPosition().y; var rc_w=new rc_windows({ id:'rc_window_opt', container: $(document.body), useOverlay: false, width:500, height:250, left: x, top: y, title:'', contentHTML:d[1] }); } else { var rc_w=new rc_windows({ id:'rc_window_opt', container: $(document.body), useOverlay: true, width:665, height:300, title:'Dodawanie produktu do koszyka - wybór opcji', contentHTML:d[1] }); } $('rc_window_opt_body').set('html',d[1]); new Request({ method: 'post', url: '/ajax/pinfo/inventory/', data: {'pid0':pid,pict:pict, searcher:true}, onComplete: function(data) { $('inventory_opt_cont'+pict+'_'+pid).set('html',data); if(typeof jQuery !== "undefined") { jQuery("body").trigger('inventoryLoaded'); } if('647'=='3815') { $$('.add-to-wishlist').addEvent('click', function(e) { var pid = $(this).get('data-id'); new Request({ method: 'get', url: "/r/"+pid+"/schowek.html", onComplete: function(data) { salert_mini('Dodano do schowka','rc_info generic'); if($$('#header_wishlist .cart-preview').length>0) { $$('#header_wishlist .cart-preview').set('html',''); } ajax_header_shopping_cart(); } }).send(); }); $$('.add-to-compare').addEvent('click', function(e) { var pid = $(this).get('data-id'); box_compare_action('add',pid); }); } if('647'==13818 ){ jQuery("select[id^=options]").select2({ templateResult: formatOption, minimumResultsForSearch: Infinity }); } } }).send(); break; default: items_cart('products_quantity'+ct+'_'+pid,type,ct, isCross); break; } } } }).send(); }); }); } function add_cart_event_10651() { $$('.add-to-cart:not(.ready)').each(function(el,i){ $(el).addClass('ready'); var pid = $(el).get('data-id'); var ct = $(el).get('data-ct'); var item=1; var itemn = $(el).get('data-item'); var type=$(el).get('data-type'); if(!type) type=0; $(el).addEvent('click', function(e){ if($(itemn)) if($(itemn).get('value')>0) item=$(itemn).get('value'); var pict='fb' var options = $(el).get('data-options'); options = JSON.parse(options); var optionsToSelectNumber = jQuery(".productsOptions[data-id='" + pid + "'] .optionsList").length; var optionsSelectedNumber = 0; if(options) { for (key in options) { if (options.hasOwnProperty(key)) optionsSelectedNumber++; } } if((optionsToSelectNumber > 0) && (!options || optionsSelectedNumber < optionsToSelectNumber)) { window.location.href='/p/0/'+pid+'/.html'; //salert_mini('Proszę wybrać odpowiedni wariant produktu!','warning'); return; } new Request({ method: 'post', url: '/ajax/pinfo/addcart/', data: {'pid':pid,item:item,pict:pict, options:options}, onComplete: function(data) { if(!data) window.location.href='/p/0/'+pid+'/.html'; else { var d=data.split('~'); switch(d[0]) { case '1': case '2': var rc_w=new rc_windows({ id:'rc_window_opt', container: $(document.body), useOverlay: true, width:665, height:300, title:'Dodawanie produktu do koszyka - wybór opcji', contentHTML:d[1] }); $('rc_window_opt_body').set('html',d[1]); new Request({ method: 'post', url: '/ajax/pinfo/inventory/', data: {'pid0':pid,pict:pict}, onComplete: function(data) { $('inventory_opt_cont'+pict+'_'+pid).set('html',data); if(typeof jQuery !== "undefined") { jQuery("body").trigger('inventoryLoaded'); } } }).send(); break; default: items_cart_10651('products_quantity'+ct+'_'+pid,type,ct, '', options); break; } } } }).send(); }); }); } function add_cart_event_7546() { $$('.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]; if($('products_quantity'+ct+'_'+pid).get('value')!='' && $('products_quantity'+ct+'_'+pid).get('value')!=0) { //var rc_vs = new Fx.Slide('addcart_cont_'+ct+'-'+pid); var rc_vs = $('addcart_cont_'+ct+'-'+pid); //rc_vs.hide(); rc_vs.setStyle('display','none'); 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) { //console.log(data); if(!data) window.location.href='/p/0/'+pid+'/.html'; else { 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] }); $('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(); rc_vs.setStyle('display','block'); items_cart('products_quantity'+ct+'_'+pid,type,ct,pict); break; } } } }).send(); } }); } function tocart(x) { if(x=='true') { var req = new Request({ method: 'post', url: '/ajax/account/lost_cart_window/', data: {"tocart":1}, onComplete: function(data) { close_window_out($('rc_window_lcart'),1,2000); window.location.href='/_cart/index/'; } }).send(); } if(x=='false') { var req = new Request({ method: 'post', url: '/ajax/account/lost_cart_window/', data: {"nocart":1}, onComplete: function(data) { close_window_out($('rc_window_lcart'),1,2000); window.location.href='/'; } }).send(); } } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop; } function video_change(t) { getId('v1').innerHTML=' ' } function change_div(did,act) { if(act==1) { $(did).getChildren('.tm1').set('class', 'tm1h fl'); $(did).getChildren('.tm2').set('class', 'tm2h fl'); $(did).getChildren('.tm3').set('class', 'tm3h fl'); } else { $(did).getChildren('.tm1h').set('class', 'tm1 fl'); $(did).getChildren('.tm2h').set('class', 'tm2 fl'); $(did).getChildren('.tm3h').set('class', 'tm3 fl'); } } function showGallery() { gallery = new rc_gallery({container: $(document.body)}); return false; } function clock(cid) { ndate=$('boxclock-'+cid).get('html'); var d1=ndate.split(' '); var d=d1[0].split('-'); var t=d1[1].split(':'); var now = new Date().getTime()/1000; var dayend = new Date(d[0],d[1]-1,d[2],t[0],t[1],t[2]).getTime()/1000; var sec = Math.abs(now-dayend); var min = Math.floor(sec/60); var hours = Math.floor(min/60); var days = Math.floor(hours/24); var years = Math.floor(days/365); sec = Math.floor(sec-min*60); min = Math.floor(min-hours*60); hours = Math.floor(hours-days*24); days = Math.floor(days-years*365); var r=""; if(days>0) r=r+"dni: "+days; if(days==0) { if(hours>0) r=r+hours; if(min>0) r=r+":"+((min<10)?"0":"")+min; if(sec>=0) r=r+":"+((sec<10)?"0":"")+sec; } $('boxclock_show-'+cid).innerHTML =r; if (now↑",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(){ var email=$('customers_email').get('value'); if($('rcP')) { $('rcP').set('value',1); } $('f_register').set('send', {onComplete: function(data) { if('647' == 9758 || '647' == 1611) createCookie('smclient', data, 365 * 10); salert('Dziękujemy! Twoje konto zostało utworzone.','10000',false,false,'none'); close_window_out($('rc_window0'),1,'10000'); if(redirectPath){ window.location.href = redirectPath; }else if(647 == 7922) { window.location.href = "http://kuplampy.pl"; } else if(647 == 3012) { window.location.href = "http://kuplampy.pl/dziekujemy-za-rejestracje"; } else { document.location.reload(); } }}); $('f_register').send(); } }); if($('UnizetoSeal1NBAKGIW')) Unizeto.Seal.install("1NBAKGIW", 6); } function openRegisterWindow() { var JsHost = (("https:" == document.location.protocol) ? 1 : 0); if('1'==1 && JsHost==0) { window.location.href='https://'+location.host+'/_register/index/' } else { var rc_w=new rc_windows({ id:'rc_window0', container: $(document.body), useOverlay: true, width:600, height:700, title:'Rejestracja nowego Klienta', contentAJAX:'/ajax/register/index/', varAJAX:{"pid":1,"item":1}, contentHTML: '/ajax/register/index/', onComplete: function(){ addRegisterValidator(); } }); } } function openLoginWindow() { var toLastCart = $('toLastCart') ? 1 : 0; var rc_w=new rc_windows({ id:'rc_window1', container: $(document.body), useOverlay: true, width:600, height:300, title:'Zaloguj się', contentAJAX:'/ajax/login/index/', varAJAX:{"pid":1,"item":1}, contentHTML: '/ajax/login/index/', 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 havecart; var lastCart; var req = new Request({ async: false, method: 'post', url: '/ajax/account/lost_cart_window/', data: {"havecart":1, 'toLastCart':toLastCart}, onComplete: function(win) { havecart=win; } }).send(); if(havecart=='havecart') { rc_w.close_window(); var rc_w2=new rc_windows({ id:'rc_window_lcart', container: $(document.body), useOverlay: true, width:600, height:170, title:'Niedokończone zakupy', contentAJAX:'/ajax/account/lost_cart_window/', varAJAX:{"window":1}, onComplete: function(){ } }); return 0; } lastCart = havecart.split('~'); if(lastCart.length == 2 && lastCart[1].length > 0){ window.location.href = '/_cart/index/' + lastCart[1] + '/'; return 0; } rc_w.close_window(); window.location.reload(); }}); $('f_login').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)}); if($('UnizetoSeal1NBAKGIW')) Unizeto.Seal.install("1NBAKGIW", 6); } }); } function ajax_header_shopping_cart() { var req = new Request({ method: 'post', url: '/ajax/cart/ajax_header_shopping_cart/', data: {}, onComplete: function(data) { var res = data.split(';'); if($('ajax_header_cart_items')) { $('ajax_header_cart_items').set('html',res[0]); if($('ajax_header_cart_value')) $('ajax_header_cart_value').set('html',res[1]); if($('ajax_header_cartmobile_value')) $('ajax_header_cartmobile_value').set('html',res[1]); if($('ajax_header_cartmobile_items')) $('ajax_header_cartmobile_items').set('html',res[0]); } else { if($('ajax_header_cart_content')) $('ajax_header_cart_content').set('html',data); } if($$('[class=ajax-items-cart]').length>0) { if(res[0]!=0) $$('[class=ajax-items-cart]').set('html',res[0]); else $$('[class=ajax-items-cart]').set('html',''); if(647==3512 || 647==13360) toggleClassOnHeaderBox('.rc-header-shopping-cart', res[0]); } if($$('.ajax-items-compare').length>0) { if(res[4]!=0) $$('.ajax-items-compare').set('html',res[4]); else { if(647==11998) $$('.ajax-items-compare').set('html',0); else $$('.ajax-items-compare').set('html',''); } if(647==3512) toggleClassOnHeaderBox('.rc-header-compare', res[4]); } if($$('.ajax-items-wishlist').length>0) { if(res[5]!=0) $$('.ajax-items-wishlist').set('html',res[5]); else { if(647==11998) $$('.ajax-items-wishlist').set('html',0); else $$('.ajax-items-wishlist').set('html',''); } if(647==3512) toggleClassOnHeaderBox('.rc-header-wishlist', res[5]); } if($$('.cart-preview').length>0) { $$('.cart-preview').set('html',''); } } }).send(); } function toggleClassOnHeaderBox(boxClass, items) { console.log(boxClass, items); if($$(boxClass)) { if(items > 0) { $$(boxClass).addClass('active_a'); if(boxClass=='.rc-header-shopping-cart' && $$('.cart_box2')) $$('.cart_box2').addClass('active_a'); } else { $$(boxClass).removeClass('active_a'); if(boxClass=='.rc-header-shopping-cart' && $$('.cart_box2')) $$('.cart_box2').removeClass('active_a'); } } } function cart_del_ajax(pid) { loading_start(); var req = new Request({ method: 'post', url: '/ajax/cart/del/', data: {"pid":pid}, onComplete: function(data) { if (window.location.href.indexOf('/step4') !== -1) { window.location.href = window.location.protocol + '//' + window.location.hostname + '/_cart/index/' return } loading_stop(); var res = data; $$('#header_shopping_cart .cart-preview').set('html',''); if(typeof sum == 'function') sum(undefined, ('647' == 16446) ? true : false); if($('trp['+pid+']')) $('trp['+pid+']').dispose(); ajax_shopping_cart(); ajax_header_shopping_cart(); } }).send(); } function openAllegroLoginWindow() { var rc_w=new rc_windows({ id:'rc_window_allegro', container: $(document.body), useOverlay: true, width:600, height:300, title:'Zaloguj się przez Allegro', contentAJAX:'/ajax/login/allegro/', varAJAX:{"pid":1,"item":1}, contentHTML: '/ajax/login/allegro/', 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) { rc_w.close_window(); window.location.reload(); }}); $('f_login').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)}); } }); } var ready='domready'; if (Browser.Engine.trident4) ready='load'; window.addEvent(ready, function() { $$('[id^=q_recommend_text]').each(function(el,i){ if ($(el.id)){ $(el.id).addEvent('click', function(e){ var rc_w=new rc_windows({ id:'rc_window3', container: $(document.body), useOverlay: true, width:600, height:300, title: 'Poleć nasz sklep', contentAJAX:'/ajax/recommend/index/', onComplete: function(){ $(rc_w.options.id+'_title').set('html',$(rc_w.options.id+'_title').get('html')); var exV = new fValidator("q_recommend", {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: "recommend_bt", fValidate_send:function(){ $('q_recommend').set('send', {onComplete: function(data) { rc_w.close_window(); salert('Powiadomienie zostało wysłane',5000,false,false,'none'); // definicja! close_window_out($('rc_window3'),1,5000); }}); $('q_recommend').send(); } }); } }); }); } }); if ($('saveCartBt')){ $('saveCartBt').addEvent('click', function(e){ var rc_w=new rc_windows({ id:'rc_window7', container: $(document.body), useOverlay: true, width:600, height:300, title: 'Zapisz koszyk', contentAJAX:'/ajax/info/save_cart/', onComplete: function(){ $(rc_w.options.id+'_title').set('html',$(rc_w.options.id+'_title').get('html')); var exV = new fValidator("q_savecart", {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: "saveCart_bt", fValidate_send:function(){ $('q_savecart').set('send', {onComplete: function(data) { rc_w.close_window(); salert('Powiadomienie zostało wysłane',5000,false,false,'none'); // definicja! close_window_out($('rc_window7'),1,5000); }}); $('q_savecart').send(); } }); } }); }); } $$('[id^=register_user_text]','.registerclass').each(function(el,i){ if ($(el)){ $(el).addEvent('click', function(e){ openRegisterWindow(); }); } }); //login $$('[id^=login_user_text]','.loginclass').each(function(el,i){ if ($(el)){ $(el).addEvent('click', function(e){ var JsHost = (("https:" == document.location.protocol) ? 1 : 0); if('1'==1 && JsHost==0) { window.location.href='https://'+location.host+'/_login/index/' } else { openLoginWindow(); } }); } }); }); function setGuest(t) { if(t.checked==true) { $('guest_type').set('value',1); if($('h_token') && $('h_token').getProperty('disabled')) { $('h_token').removeProperty('disabled'); } } else { $('guest_type').set('value',0); if($('h_token')) { $('h_token').setProperty('disabled'); } } eventRegisterType(); } function rcPlaceholder() { jQuery(document).ready(function() { if (!jQuery.support.placeholder) { var active = document.activeElement; jQuery(':text').focus(function() { if (jQuery(this).attr('placeholder') != '' && jQuery(this).val() == jQuery(this).attr('placeholder')) { jQuery(this).val('').removeClass('hasPlaceholder'); } }).blur(function() { if (jQuery(this).attr('placeholder') != '' && (jQuery(this).val() == '' || jQuery(this).val() == jQuery(this).attr('placeholder'))) { jQuery(this).val(jQuery(this).attr('placeholder')).addClass('hasPlaceholder'); } }); jQuery(':text').blur(); jQuery(active).focus(); jQuery('form').submit(function() { jQuery(this).find('.hasPlaceholder').each(function() { if (jQuery(this).val() == jQuery(this).attr('placeholder')) { jQuery(this).val(''); } }); }); } }); } function rc3Event() { $$('.add-to-compare').addEvent('click', function(e) { var pid = $(this).get('data-id'); box_compare_action('add',pid); }); $$('.remove-from-wishlist').addEvent('click', function(e) { var pid = $(this).get('data-id'); var self = this; var product = this.getParent('.product-one'); new Request({ method: 'get', url: "/rd/"+pid+"/schowek.html", onComplete: function(data) { product.morph({opacity: 0}); product.get('morph').chain(function() { product.dispose(); }); ajax_header_shopping_cart(); } }).send(); }); $$('.add-to-wishlist').addEvent('click', function(e) { var pid = $(this).get('data-id'); new Request({ method: 'get', url: "/r/"+pid+"/schowek.html", onComplete: function(data) { salert_mini('Dodano do schowka','rc_info generic'); if($$('#header_wishlist .cart-preview').length>0) { $$('#header_wishlist .cart-preview').set('html',''); } ajax_header_shopping_cart(); } }).send(); }); if(647!=1652 /*&& 647!=14788*/) $$('.let-me-know').addEvent('click', function(e) { openQuestionWindow(); }); $$('.tell-a-friend').addEvent('click', function(e) { openSendFriendWindow(); }); $$('.print-page','.print-page-btn').addEvent('click', function(e) { openPrintPageWindow(); }); $$('.add-comment').addEvent('click', function(e) { var pid = $(this).get('data-id'); var mid = $(this).get('data-mid'); open_opinions(mid,pid); }); add_cart_event_new(); } function zeroPad(n, width) { z = '0'; n = n + ''; return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; } window.addEvent('domready', function() { //rc-Carousel //rc3 rc3Event(); categoriesSearcherEvent(); if (647==2942){ setInterval(function () { var calculators = document.getElementsByClassName('promotions_date_to_timestamp'); for (var i = 0, j = calculators.length; i < j; i++) { var element = calculators[i]; var products_id = calculators[i].dataset.id; if ((navigator.userAgent.match(/iPhone/i))) var date = new Date(parseInt(element.getElements('a').get('html') + '000')); else var date = new Date(parseInt(element.get('html') + '000')); var today = new Date(); var diff = parseInt((date.getTime() - today.getTime()) / 1000); var days = parseInt(diff / 60 / 60 / 24); var hours = parseInt((diff - (days * 60 * 60 * 24)) / 60 / 60); var minutes = parseInt((diff - (days * 60 * 60 * 24) - (hours * 60 * 60)) / 60); var seconds = parseInt(diff - (days * 60 * 60 * 24) - (hours * 60 * 60) - (minutes * 60)); jQuery('.countdown-days[data-id="' + products_id + '"]').html(zeroPad(days, 2)); jQuery('.countdown-hours[data-id="' + products_id + '"]').html(zeroPad(hours, 2)); jQuery('.countdown-minutes[data-id="' + products_id + '"]').html(zeroPad(minutes, 2)); jQuery('.countdown-seconds[data-id="' + products_id + '"]').html(zeroPad(seconds, 2)); } }, 1000); } else { if($('promotions_date_to_timestamp')) { setInterval(function() { if((navigator.userAgent.match(/iPhone/i))) var date = new Date(parseInt($('promotions_date_to_timestamp').getElements('a').get('html')+'000')); else var date = new Date(parseInt($('promotions_date_to_timestamp').get('html')+'000')); if((navigator.userAgent.match(/iPhone/i)) && date <= 0 ) var date = new Date(parseInt($('promotions_date_to_timestamp').get('html')+'000')); var today = new Date(); var diff = parseInt((date.getTime()-today.getTime())/1000); var days = parseInt(diff/60/60/24); var hours = parseInt((diff-(days*60*60*24))/60/60); var minutes = parseInt((diff-(days*60*60*24)-(hours*60*60))/60); var seconds = parseInt(diff-(days*60*60*24)-(hours*60*60)-(minutes*60)); $$('.countdown-days').set('html',zeroPad(days,2)); $$('.countdown-hours').set('html',zeroPad(hours,2)); $$('.countdown-minutes').set('html',zeroPad(minutes,2)); $$('.countdown-seconds').set('html',zeroPad(seconds, 2)); if(parseInt(zeroPad(diff, 2)) <= 1) location.reload(); }, 1000); } } if($('f_help')) setPassHelpEvent(); if($('f_headlogin')) var exV = new fValidator("f_headlogin", { 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: "headlogin_bt", fValidate_send:function(){ $('f_headlogin').set('send', {onComplete: function(data) { window.location.reload(); }}); $('f_headlogin').send(); } }); if($('f_headregister')) var exV = new fValidator("f_headregister", { 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: "headregister_bt", fValidate_send:function(){ $('f_headregister').submit(); } }); if($('conf_o') && 647!=3830) var exV = new fValidator("conf_o", { 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: "orders_realize_bt", fValidate_send:function(){ if(647!=3830) { // klikochron if($('_s-checkbox') && ($('_s-checkbox').checked === true && $('_s-pib').checked === false)) return false; if(647==344 && $('tos_checkbox').checked == false) { alert('Proszę zaakceptować postanowienia regulaminu'); return false; } orders_realize(); if($('conf_o')) { order_send('conf_o'); $('conf_o').set('id','conf_o1'); }; } } }); $$('form[id*=newsletter]').each(function(el) { el.setStyles({ // position: 'relative' }); c=el.getElement('input').getComputedSize(); var containerN=new Element('div',{id: el.get('id')+'_container'}).addClass('rc_windowContainer').setStyles({ // position: 'absolute', top: (c.height+c['padding-bottom']+c['padding-top']), left: (0), border: '1px solid #B7B7B7', padding: '5px', 'padding-bottom': '10px' }); new Element('input',{type:'checkbox',value:1,name:'get_invoice',id:'get_invoice'}).addClass('fValidate[\'required\']').inject(containerN,'bottom'); new Element('span',{html:'cos'}).inject(containerN,'bottom'); //containerN.inject(el,'bottom'); if($(el.get('id')+"_bt")) new fValidator(el.get('id'), { 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: el.get('id')+"_bt", fValidate_send:function(){ standard_newsletter_submit(el);//el.submit(); } }); }); if (typeof jQuery == 'function') { //rcPlaceholder(); jQuery('.decrease').live('click', function(e) { var target = jQuery(this).attr('data-target'); var qt = parseInt($(target).get('value')); if(647==18424) { countValue =jQuery(this).attr('data-count'); if(countValue == 0 || typeof countValue == "undefined") countValue = 1; qt = parseInt(qt) + parseInt(countValue); } else { qt++; } $(target).set('value',qt); $(target).onkeyup(); }); jQuery('.increase ').live('click', function(e) { var target = jQuery(this).attr('data-target'); var qt = parseInt($(target).get('value')); var min_order = jQuery('[id="'+target+'"]').data('min-order'); if(qt>1) { if(647==18424) { countValue = jQuery(this).attr('data-count'); if(countValue == 0 || typeof countValue == "undefined") countValue = 1; if(parseInt(qt) >= parseInt(countValue)) qt = parseInt(qt) - parseInt(countValue); } else { qt--; } if(min_order > 0 && min_order > qt) qt = min_order; $(target).set('value',qt); $(target).onkeyup(); } }); jQuery('.table-delete').live('click',function(e) { var pid = ''; var id = jQuery(this).children('a').attr('data-id'); var options = jQuery(this).children('a').attr('data-options'); pid = id + '_' + options; cart_del_ajax(pid) }); jQuery('.remove-from-cart').live('click',function(e) { var pid = ''; var id = jQuery(this).attr('data-id'); var options = jQuery(this).attr('data-options'); pid = id + '_' + options; cart_del_ajax(pid) }); jQuery('.remove-from-wishlist').live('click',function() { var pid = ''; var id = jQuery(this).attr('data-id'); var req = new Request({ method: 'get', url: '/rd/'+id+'/schowek.html', onComplete: function(data) { if($$('#header_wishlist .cart-preview').length>0) { $$('#header_wishlist .cart-preview').set('html',''); } ajax_header_shopping_cart(); } }).send(); }); } add_cart_pinfo_new(); $$('.change-search-list-type').addEvent('click', function(e) { $$('.change-search-list-type').removeClass('btn-active'); $(this).addClass('btn-active'); var newClass = $(this).get('data-class'); $$('ul.listing-classic').each(function(el) { $(el).removeProperty('class'); $(el).addClass('listing-classic'); $(el).addClass(newClass); $$('.product-one', '.product-many').removeClass('ready') correctBoxesHeight1(); }); Cookie.write('change-search-list-type', newClass, {duration: 30}); }); if($$('.change-search-list-type').length>0) { var listType = Cookie.read('change-search-list-type'); if(!listType) { if($('listing_layout')) switch(parseInt($('listing_layout').get('html'))) { case 1: listType='one-in-row'; break; case 2: listType='tree-in-row'; break; case 3: break; } } if(listType) { $$('.change-search-list-type').each(function(el) { if($(el).get('data-class')==listType) $(el).fireEvent('click'); }); } } if($$('.fValidator-form').length>0 && $$('#f_login').length>0) { 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 havecart; var req = new Request({ async: false, method: 'post', url: '/ajax/account/lost_cart_window/', data: {"havecart":1}, onComplete: function(win) { havecart=win; } }).send(); if(havecart=='havecart') { var rc_w2=new rc_windows({ id:'rc_window_lcart', container: $(document.body), useOverlay: true, width:600, height:170, title:'Niedokończone zakupy', contentAJAX:'/ajax/account/lost_cart_window/', varAJAX:{"window":1}, onComplete: function(){ } }); return 0; } if(647==10019) window.location.href="https://kuplampy.pl/"; else window.location.reload(); }}); $('f_login').send(); } }); } // if($('ajax_header_cart_items')) { $('ajax_header_cart_items').set('html',''); if($('ajax_header_cart_value')) $('ajax_header_cart_value').set('html',''); } else { if($('ajax_header_cart_content')) $('ajax_header_cart_content').set('html',''); } // var w=window.location.toString(); // re = /_cart\/index/; // if(!w.match(re)) if($('ajax_header_cart_items') || $('ajax_header_cart_content')) ajax_header_shopping_cart(); $$('.box_Carousel').each(function(el,i){ var box=el.id.split('-'); var box_config={}; if($('config-'+box[2])) { var as = $('config-'+box[2]).getElements('span'); as.each(function(el1,i){ box_config[el1.get('id')]=parseInt(el1.get('html')); }); } new RCCarousel(el.id, {id:box[2],width:box_config['config-opt-width-'+box[2]], height:box_config['config-opt-height-'+box[2]],duration:box_config['config-opt-duration-'+box[2]],delay:box_config['config-opt-delay-'+box[2]],box:box_config['config-opt-box-'+box[2]],autoplay:box_config['config-opt-autoplay-'+box[2]]}); }); if($('header_top_menu')) size=$('header_top_menu').getSize(); $$('[id^=header_second_menu_]').each(function(el2,i2){ if($('header_top_menu')) el2.setStyle('top',size.y); }); $$('[id^=second_menu_show_]').each(function(el,i){ el.addEvent('click', function(e){ id=el.get('id').split('_'); $$('[id^=header_second_menu_]').each(function(el2,i2){ if(el2.get('id')!='header_second_menu_'+id[3]) el2.setStyle('display','none'); }); if($('header_second_menu_'+id[3])) $('header_second_menu_'+id[3]).toggle(); }); }); $(document.body).addEvent('click', function(e){ $$('[id^=header_second_menu_]').each(function(el,i){ if(e.target.id.length>0 && (e.target.get('id').match('second_menu_show_') || e.target.get('id').match('second_menu_ashow_'))) { } else { $$('[id^=header_second_menu_]').each(function(el2,i2){ el2.setStyle('display','none'); }); } }); }); }); window.addEvent('load', function() { $$('.box_Carousel').each(function(el,i){ var rcmax=0; var size=0; var box=el.id.split('-'); if($('rc-carousel-inner-'+box[2])) { var divs = $('rc-carousel-inner-'+box[2]).getElements('div'); divs.each(function(el1){ if(el1.className=='rc-carousel-animate') { size=el1.getSize(); if(size.y>rcmax) rcmax=size.y; } }); $('rc-carousel-inner-'+box[2]).setStyle("height",rcmax); } }); }); function setPassHelpEvent(ind) { if(!ind) ind=''; if(!$("f_help"+ind)) ind=''; var exV = new fValidator("f_help"+ind, { 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_help_bt"+ind, fValidate_send:function(){ $('f_help'+ind).set('send', {onComplete: function(data) { if($('login_help_bt')) $('login_help_bt').hide(); salert('Na podany przez Ciebie adres e-mail wysłana została wiadomość z linkiem umożliwiającym zresetowanie hasła.','10000',false,false,'none'); if($('rc_window2')) close_window_out($('rc_window2'),1,'10000'); }}); $('f_help'+ind).send(); } }); } function pass_help(alert){ if(alert==1) { if($('rc_alert0')) { close_window_out($('rc_alert0'),0) overlay=false; } } if($('rc_window1')) { close_window_out($('rc_window1'),0) overlay=false; } else overlay=true; var rc_w=new rc_windows({ id:'rc_window2', container: $(document.body), useOverlay: overlay, width:600, height:300, title: 'Przypomnij hasło', contentAJAX:'/ajax/login/help/', varAJAX:{"pid":1,"item":1}, contentHTML: '/ajax/login/help/', onComplete: function(){ setPassHelpEvent(2); $('login_email').addEvent('keydown', function(event){if(event.key=='enter' && $('token').get('value')!='') exV._onSubmit(event)}); $('token').addEvent('keydown', function(event){if(event.key=='enter' && $('login_email').get('value')!='') exV._onSubmit(event)}); } }); } /* new iMask({ onValid: function(event, obj) {obj.removeClass('rc_valid_no'); obj.addClass('rc_valid_ok')}, onInvalid: function(event, obj) {obj.removeClass('rc_valid_ok'); obj.addClass('rc_valid_no')} }); */ var cat_ajax_list = function() { $$('[id^=catl_]').each(function(el){ el.removeEvents('click'); }); $$('[id^=catl_]').each(function(el){ el.addEvent('click',function(){ if(647==5141) { $$('[id^=catls_]').setStyle('display','none'); } if(647!=2065 && 647!=10591) { var url = $(this).getElements('a'); url = url[0]; var href = url.get('href'); href=href.split('/'); } //$$('div[id^=catl_] > div[id^=catls_]').each(function(el1){ //console.log(el1) //}); //$$('[id^=catls_]').each(function(el1){ //if(el.get('id').replace('catl_','')!=el1.get('id').replace('catls_','')) //el1.setStyles({'display':'none'}); //}); var id=el.get('id').replace('catl_',''); if(647!=2065 && 647!=10591) { if(href[href.length-3]=='c') href = href[href.length-1]; else href = id + '.html'; } if($('catls_'+id)) { $('catls_'+id).toggle(); } else { if(647!=5141) { loading_start(); } var req = new Request({ method: 'post', url: '/ajax/categories_ajax/get_tree/', data: {"cid":id}, onComplete: function(data) { if(647==5141) { // console.log($$('[id^=catls_]')); $$('[id^=catls_]').setStyle('display','none'); } if(data=="" && 647!=2065) { window.location.href='/c/'+id+'/'+ href; } else { var nElement = new Element('div', { id: 'catls_'+id }); nElement.set('html',data); el.grab(nElement,'after'); cat_ajax_list(); loading_stop(); } if(''==1 && ''=='true' && window.location.search=="" && 647!=2065) { window.location.href='/c/'+id+'/'+ href; } } }).send(); } }); }); } window.addEvent('domready', function() { $$('[id^=widget_shop]').each(function(el,i){ if(el.get('class')=='widgets_fcenter_left') { var half=window.getWidth()/2; el.setStyle('left',half+el.getStyle('left').toInt()); } if(el.get('class')=='widgets_fcenter_right') { var half=window.getWidth()/2; el.setStyle('right',half+el.getStyle('right').toInt()); } }); var search_timer = 1; function suggers_search(words, container_id) { if(container_id == undefined || !$(container_id)) container_id = 'sugget_container'; if(647==8641){ suggers_search_new(words); return; } var cat=0; if($('categories_searcher')) cat=$('categories_searcher').get('value'); clearTimeout(search_timer); search_timer=setTimeout(function validate(){ var req = new Request.JSON({ method: 'post', url: '/ajax/searcher/suggest/', data: {"words":words,'categories':cat}, onComplete: function(jo) { if($(container_id)) $(container_id).dispose(); var container=new Element('div',{id: container_id}).addClass('rc_windowContainer').setStyles({ // position: 'absolute', top: (c.top+c.height), left: (c.left), border: '1px solid #B7B7B7', padding: '5px', 'padding-bottom': '10px' }); container.set('html',''); var close=new Element('div').setStyles({ clear:'both', 'text-align':'right', 'padding-right':'5px', 'cursor':'pointer', 'font-weight': 'bold', 'font-size': '14px' }); close.set('html','x'); close.addEvent('click',function(event){ $(container_id).dispose(); }); var more=new Element('div').setStyles({ clear:'both', 'text-align':'right', 'padding-right':'5px', 'cursor':'pointer', 'font-weight': 'bold' }); more.set('html',''); more.addClass('suggest-more'); var cmpa=new Element('a',{'href':'javascript:void(0)'}); cmpa.set('html','więcej wyników'); cmpa.inject(more,'inside'); more.addEvent('click',function(event){ if($('f_box_search_2')) { $('f_box_search_2').submit(); } else { if($('f_box_search')) $('f_box_search').submit(); } }); close.inject(container,'inside'); //alert(JSON.encode(jo)); if(jo!=null){ jo['elements'].each(function(el) { var cm=new Element('div').setStyles({ clear:'both' }); cm.addClass('suggest-item'); var cm1=new Element('div').setStyles({ float:'left', 'padding':'5px', 'width':'50px', 'text-align':'center' }); cm1.addClass('suggest-photo'); var cm2=new Element('div').setStyles({ float:'left', 'padding-top':'5px', 'padding-right':'5px', 'padding-left':'5px', 'font-weight':'bold', 'width':'300px' }); cm2.addClass('suggest-name'); var cm3=new Element('div').setStyles({ 'border-bottom': '1px solid #B7B7B7', clear: 'both' }); cm3.addClass('suggest-separator'); if(el['image'].length==0) var src=jo['paths']['img']+""+jo['paths']['img0']; else var src=jo['paths']['img']+""+jo['paths']['img1']+""+el['image']; var cmi=new Element('img',{'src':src}); var cmpa=new Element('a',{'href':jo['paths']['http']+""+el['href']}); cmpa.set('html',el['products_name']); var cmia=new Element('a',{'href':jo['paths']['http']+""+el['href']}); cmi.inject(cmia,'inside'); cmia.inject(cm1,'inside'); cmpa.inject(cm2,'inside'); cm1.inject(cm,'inside'); cm2.inject(cm,'inside'); cm.inject(container,'inside'); cm3.inject(cm,'inside'); }); more.inject(container,'inside'); if(647==17455 || 647==17954 || 647==50631) container.inject($('sugget_container2'),'inside'); else container.inject($(document.body),'inside'); } else { if($(container_id)) $(container_id).dispose(); } } }).send(); },400); } if('0'=='1') { $$('[name^=search_value]').each(function(elm,i){ elm.addEvent('keyup',function(event){ var value=elm.get('value'); if(value.length>=2){ c=elm.getCoordinates(); //alert(JSON.encode(c)); suggers_search(value); } }); }); } cat_ajax_list(); }); function vouchers_windows(action,code) { if(action=='open') { var rc_w=new rc_windows({ id:'rc_window_vouchers', container: $(document.body), useOverlay: true, width:600, height:300, title: 'Bony rabatowe', contentAJAX:'/ajax/cart/vouchers_windows/', onComplete: function(data) { } }); } if(action=='send') { var req = new Request({ method: 'post', url: '/ajax/cart/voucher/', data: {"code":code,"cart":"cart"}, onComplete: function(data) { $('vouchers_results').set('html',data); $('vcode').set('value',''); shpping_ajax($('countries').get('value')); $('vouchers_error').setStyle('display','none') if($('vouchers_error2')) { $('vouchers_error').set('html',$('vouchers_error2').get('html')); $('vouchers_error').setStyle('display','block') var vouchers_error = (function () {$('vouchers_error').setStyle('display','none')}).delay(3000); } } }).send(); } if(action=='del') { var req = new Request({ method: 'post', url: '/ajax/cart/voucher/', data: {"code":code,"del":"del"}, onComplete: function(data) { $('vouchers_results').set('html',data); shpping_ajax($('countries').get('value')); } }).send(); } } function open_presentation(href,w,h) { if(!w) w=630; if(!h) h=420; var rc_w2=new rc_windows({ id:'rc_window_pres', container: $(document.body), useOverlay: true, width:w, height:h, type:'iframe', title:'Prezentacja 360', contentAJAX:href, onComplete: function(){ } }); $('rc_window_pres_body').setStyle('width',$('rc_window_pres_body').getSize().x+30); } window.addEvent("resize", function() { $$('.rc_windowContainer').each(function(el){ size= el.getSize(); el.setStyle('left',(document.body.clientWidth/2-size.x/2)); }); }); function discounts_info(pid) { var rc_w222=new rc_windows({ id:'rc_window_discounts222', container: $(document.body), useOverlay: true, width:600, height:300, title: 'Dowiedz się więcej o rabatach!', contentAJAX:'/ajax/pinfo/discounts_info/', varAJAX:{"pid":pid}, onComplete: function(){ add_cart_event(); $$('.addcart').each(function(el){ el.addEvent('click',function(){ var timer = (function () { var rc_overlay = new Overlay({ container:$(document.body), id:'_rcw2', before:$('rc_window_opt') }); rc_overlay.show(); $$('.rc_windowbtclose').each(function(el){ el.addEvent('click',function(){ $('OverlayContainer_rcw2').destroy(); }) }); }).delay(500); var timer = (function () { $$('.rc_button').each(function(el){ el.addEvent('click',function(){ var timer = (function () { $('OverlayContainer_rcw2').destroy(); }).delay(1500); }) }); }).delay(2000); }) }); if(document.location.href.match('_cart')) { $$('.rc_windowbtclose').each(function(el){ el.addEvent('click',function(){ document.location.href='/_cart/index/'; }) }); } } }) } function filterDelete(el,isInput) { if($(el)) { if(isInput) { if($(el).set('value','')); } else { if($(el).get('checked')) $(el).set('checked',false); else $(el).set('checked',true); } } sendFilterForm(); } function sendFilterForm() { $('f_filter').submit(); } var linkChanged = function(url,data) { if(!data) data = {filter:false}; if (history.pushState) { window.history.pushState(data, null, url); } else window.location.href=url; }; var onCompleted = function(data) { var content; content=$$('.content_center_in'); if(content.length) content.set('html',data); else { if($('content_x')) $('content_x').set('html',data); else if($('content_2')) $('content_2').set('html',data); } ajaxPagination(); new MultiSelect(".MultiSelect"); slideContent(); add_cart_event(); }; function ajaxPagination() { if($('sort') && 647!=9801 && 647!=8079) { $('sort').removeProperty('onchange'); $('sort').addEvent('change', function() { var url = window.location.protocol + '//' + window.location.host + window.location.pathname; var re=/[\&]?sort=[\s\S]*[\&]/gi; var re1=/[\&]?sort=[\s\S]*/gi; var search = window.location.search.substring(1).replace(re,'&').replace(re1,''); if(search.length>0) url = url+'?'+search+'&sort='+$('sort').get('value'); else url = url+'?sort='+$('sort').get('value'); linkChanged(url); window.scrollTo(0,0); }); } if($('pop') && 647!=9801 && 647!=8079) { $('pop').removeProperty('onchange'); $('pop').addEvent('change', function() { var url = window.location.protocol + '//' + window.location.host + window.location.pathname; var re=/[\&]?pop=[\s\S]*[\&]/gi; var re1=/[\&]?pop=[\s\S]*/gi; var search = window.location.search.substring(1).replace(re,'&').replace(re1,''); if(search.length>0) url = url+'?'+search+'&pop='+$('pop').get('value'); else url = url+'?pop='+$('pop').get('value'); linkChanged(url); window.scrollTo(0,0); }); } if(647 != 473 && 647 != 9801 && 647!=8079) { // m.g. if($$('.li_listing')) { $$('.li_listing').removeProperty('onclick'); $$('.li_listing').addEvent('click', function(e) { var url = $(this).getElement('a').get('href'); linkChanged(url); window.scrollTo(0,0); }); } } } function getUrlVars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; } function sendFilterFormAjax() { var search=true; //window.location.href) var key=$('keywords').get('value').replace(/\s+/gi,'').length var cat=/\/c\//.test(window.location.href); if(getUrlVars()['keywords'] && getUrlVars()['keywords'].length>0 && key<2 && cat==false) search=false; var url = window.location.protocol + '//' + window.location.host + $('f_filter').get('action') + '?' + $('f_filter').toQueryString(); if(search) linkChanged(url,{filter:true}); else { $('keywords').setStyles({'border':'1px solid red'}) } } function copyAddress() { jQuery('[data-copy]').each(function( index ) { el=jQuery(this); var id=el.attr('id').replace('address[','').replace(']',''); if(el.attr('data-copy')=="") { var elTo=jQuery('[id^="invoice['+id+']"]')[0]; jQuery(elTo).val(el.val()); } else { var elTo=jQuery('[class^="'+el.attr('data-copy')+'"]')[0]; jQuery(elTo).val(el.val()); } }); } function categoriesSearcherEvent() { if($('search_value')) { if($('categories_search_value')) $('categories_search_value').fade('out'); $('search_value').addEvent('click', function(e) { categoriesSearcher(1); }) $(document.body).addEvent('click', function(e) { categoriesSearcher(0,e.target); }) } } function categoriesSearcher(t,id) { var pid=null; if(id && id.length>0) { idValue = id.get('id'); if(idValue == 'search_value') pid = $('categories_searcher'); } else idValue = ''; var pid1=''; if(pid!=null && pid.length>0) { pid1=pid.get('id'); } if($('categories_search_value')) { //if($('categories_search_value').getStyle('visibility')=='visible' && t==0 && idValue!='search_value' && idValue!='categories_searcher' && pid1!='categories_searcher') // visibility = document.getElementById("categories_search_value").style.visibility if(visibility=='visible' && t==0 && idValue!='search_value' && idValue!='categories_searcher' && pid1!='categories_searcher') { if($('search_value').get('value')=="") { $('categories_search_value').fade('out'); //$('categories_search_value').setStyle('display','none'); //$('search_value').set('tween', {duration: 'short', transition: 'cubic:in'}); //$('search_value').tween('width', [300, 200]); } } //if($('categories_search_value').getStyle('visibility')=='hidden' && t==1) // ie8 problem if(visibility=='hidden' && t==1) { $('categories_search_value').fade('in'); //$('categories_search_value').setStyle('display','block'); //$('search_value').set('tween', {duration: 'short', transition: 'cubic:in'}); //$('search_value').tween('width', [200, 300]); } } } function check_items() { var pid = $('products_id').get('value'); var opt={}; var opts={}; var opts1=new Array(); opts1[0]={}; opts1[1]={}; var opts1s=new Array(); opts1s[0]={}; opts1s[1]={}; var suff=''; var s=true; if($('options_form'+suff)) { var sels = $('options_form'+suff).getElementsByTagName('select'); for(var i=0; iSzukaj'); else jQuery('#filterSearch').html('Szukaj'); jQuery('#filterSearch').removeClass('disable'); } } } } } } function replaceMotorsSelect(data,name,selected,url) { var nselect = jQuery(''); nselect.append(new Option('Wybierz', -1)); console.log(typeof data); if(typeof data !== "undefined") { Object.keys(data).each(function(option,value){ if(option == selected) nselect.append(new Option(option, option,true,true)); else nselect.append(new Option(option, option)); }); } jQuery('#filter\\['+name+'\\]').remove(); jQuery('#'+name+'Select').append(nselect); } function standard_newsletter_submit(formElement) { var emailInput = formElement.querySelector('[name="newsletter_email"]').value; var countCheckboxes = formElement.querySelectorAll('[name^="checkboxes"]').length; if(countCheckboxes){ save_standard_newsletter_submit(formElement); return; } var req = new Request({ async: false, method: 'post', url: '/ajax/register/get_checkboxes_for_newsletter/', data: { newsletter_email: emailInput }, onComplete: function(html) { if (html.trim() === '') { formElement.action = "/ajax/register/newsletter_add/"; save_standard_newsletter_submit(formElement); } else { new rc_windows({ id: 'rc_window_newsletter_checkboxes', container: document.body, useOverlay: true, width: 600, height: 300, title: 'Newsletter', contentHTML:html }); new fValidator("get_checkboxes_for_newsletter", { 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: "get_checkboxes_for_newsletter_bt", fValidate_send: function () { var formNewslleterInModal = document.getElementById('rc_window_newsletter_checkboxes').querySelector('form.fValidator-form'); standard_newsletter_submit(formNewslleterInModal); close_window_out('rc_window_newsletter_checkboxes'); close_overlay_out(0); } }); } } }).send(); } function save_standard_newsletter_submit (formElement) { $(formElement).set('send', { onComplete: function (data) { data = JSON.parse(data); salert_mini(data.msg, data.status == 'error' ? 'error' : 'success'); if (data.status == 'ok') { $$('[id^=newsletter_email]').set('value', ''); } } }); formElement.send(); jQuery(document.body).trigger('rc_event_newsletter_submit', { email: formElement.querySelector('[name="newsletter_email"]').value }); } function order_send(fid) { $(fid).set("send", { onComplete: function (msg) { try { var data = JSON.parse(msg); if(!data.order_id){ throw 1; } //data.location if (window.dataLayer) { rc_event_purchase(data.order_id, data.location); } else { window.location.href = data.location; } }catch (e) { window.location.href = '/_cart/index/'; } } }).send(); } function rc_event_purchase(orderId, location) { var request = { "orders":[{orders_id: orderId}] }; window.fetch && fetch("/ajax.php?p=conversion&f=orders_info&ssl=1", { method: "POST", body: JSON.stringify(request), credentials: "same-origin", headers: { "Accept": "application/json", "Content-Type": "application/json" } }).then(function (response) { return response.json(); }).then(function (response) { var order = response.orders.pop(); console.log("rc_event_purchase", order); var products = order.products.map(function (product) { return { "name": product.name, "id": product.products_id, "price": product.payment_gross_price, "brand": product.pr_name, "category": product.main_category_path, "variant": null, "quantity": product.item }; }); var promise = new Promise(function (resolve,reject) { window.dataLayer.push({ "event": "purchase", "ecommerce": { "currencyCode": order.currency, "purchase": { "actionField": { "id": order.orders_id, "affiliation": order.affiliation_name, "revenue": order.gross_price, "tax": order.gross_tax_price, "shipping": order.gross_shipping_price }, "products": products } }, "eventCallback": function () { resolve(); } }); setTimeout(reject, 3000,"timeout"); }); promise.then(function () { return window.fetch && fetch("/Z6d5BNkK4Auv3QF/scripts_cron/_api/confirmPurchase.php").then(function () { console.log("confirmed"); window.location.href = location; }); }).catch(function (err) { console.error(err); window.location.href = location; }); }).catch(console.error); }