function add_cart_event() { $$('.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) { 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(); 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 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: "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(); } }); } }); }); } }); $$('[id^=register_user_text]').each(function(el,i){ if ($(el.id)){ $(el.id).addEvent('click', function(e){ var JsHost = (("https:" == document.location.protocol) ? 1 : 0); if(''==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(){ new Element('input',{name:'csrf',value:'rc',type:'hidden'}).inject($('f_register')); exV = new fValidator("f_register",{languageConfig:{l:{required:"To pole jest obowiązkowe! ",alpha:"Pole zawiera nie prawidłowe znaki! ",alphanum:"Pole zawiera nie prawidłowe znaki! ",integer:"Nieprawidłowe dane! ",real:"Nieprawidłowy numer! ",date:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateISO8601:"Prawidłowy format daty to (mm/dd/rrrr)! ",dateEU:"Prawidłowy format daty to (mm/dd/rrrr)!) ",email:"Nieprawidłowy adres e-mail! ",phone:"Nieprawidłowy numer telefonu! ",url:"Nieprawidłowy adres URL! ",zip:"Nieprawidłowy format kodu pocztowego! ",confirm:"Nieprawidłowe hasło! "}}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "register_bt", fValidate_send:function(){ var email=$('customers_email').get('value'); $('f_register').set('send', {onComplete: function(data) { salert('Dziękujemy! Twoje konto zostało utworzone.','10000',false,false,'none'); close_window_out($('rc_window0'),1,'10000'); document.location.reload(); }}); $('f_register').send(); } }); } }); } }); } }); //login $$('[id^=login_user_text]').each(function(el,i){ if ($(el.id)){ $(el.id).addEvent('click', function(e){ var JsHost = (("https:" == document.location.protocol) ? 1 : 0); if(''==1 && JsHost==0) { window.location.href='https://'+location.host+'/_login/index/' } else { 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 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') { 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; } rc_w.close_window(); window.location.href='/'; }}); $('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)}); } }); } }); } }); }); window.addEvent('domready', function() { //rc-Carousel $$('.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 pass_help(){ 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(){ var exV = new fValidator("f_help", { 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", fValidate_send:function(){ $('f_help').set('send', {onComplete: function(data) { salert('Hasło zostało przesłane na wskazany adres e-mail!','10000',false,false,'none'); close_window_out($('rc_window2'),1,'10000'); }}); $('f_help').send(); } }); $('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(){ var id=el.get('id').replace('catl_',''); if($('catls_'+id)) { $('catls_'+id).toggle(); } else { loading_start(); var req = new Request({ method: 'post', url: '/ajax/categories_ajax/get_tree/', data: {"cid":id}, onComplete: function(data) { var nElement = new Element('div', { id: 'catls_'+id }); nElement.set('html',data); el.grab(nElement,'after'); cat_ajax_list(); loading_stop(); } }).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()); } }); if(''=='1') { $$('[name^=search_value]').each(function(elm,i){ elm.addEvent('keyup',function(event){ var value=elm.get('value'); if(value.length>=3){ c=elm.getCoordinates(); //alert(JSON.encode(c)); var req = new Request.JSON({ method: 'post', url: '/ajax/searcher/suggest/', data: {"words":value}, onComplete: function(jo) { if($('sugget_container')) $('sugget_container').dispose(); var container=new Element('div',{id: 'sugget_container'}).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){ $('sugget_container').dispose(); }); var more=new Element('div').setStyles({ clear:'both', 'text-align':'right', 'padding-right':'5px', 'cursor':'pointer', 'font-weight': 'bold' }); more.set('html',''); 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){ $('f_box_search_2').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' }); var cm1=new Element('div').setStyles({ float:'left', 'padding':'5px', 'width':'50px', 'text-align':'center' }); var cm2=new Element('div').setStyles({ float:'left', 'padding-top':'5px', 'padding-right':'5px', 'padding-left':'5px', 'font-weight':'bold', 'width':'300px' }); var cm3=new Element('div').setStyles({ 'border-bottom': '1px solid #B7B7B7', clear: 'both' }); 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'); } else $('sugget_container').dispose(); container.inject($(document.body),'inside'); } }).send(); } }); }); } 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) { vouchers_windows('send',''); } }); } 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) { var rc_w2=new rc_windows({ id:'rc_window_pres', container: $(document.body), useOverlay: true, width:630, height:420, type:'iframe', title:'Prezentacja 360', contentAJAX:href, onComplete: function(){ } }); } 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_w=new rc_windows({ id:'rc_window_discounts', 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 register_invoice(t) { if($('get_invoice').get('checked')==true) { $('invoice_div').setStyle('display','block'); section=document.getElementById('invoice_div'); inputs=section.getElementsByTagName('input'); for(var i=0; i