PeriodicalExecuter = new Class({ // name: 'PeriodicalExecuter', initialize: function(callback, frequency) { this.callback = callback; this.frequency = frequency; this.currentlyExecuting = false; this.registerCallback() }, registerCallback: function() { this.stop(); this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); return this }, execute: function() { this.callback(this); return this }, stop: function() { if (!this.timer) return this; clearInterval(this.timer); this.timer = null; return this }, onTimerEvent: function() { if (!this.currentlyExecuting) { try { this.currentlyExecuting = true; this.execute(); } finally { this.currentlyExecuting = false; } } return this } }); var CountDown = new Class({ /* options: { onChange: $empty, onComplete: $empty, date: null, frequency: 1000 //define the update frequency (in ms), default to 1000 }, */ Implements: [Options, Events], initialize: function (options) { this.setOptions(options); if(!this.options.date instanceof Date) this.options.date = new Date(this.options.date); this.timer = new PeriodicalExecuter(this.update.bind(this), (this.options.frequency || 1000) / 1000); }, stop: function () { this.timer.stop(); return this }, start: function () { this.timer.registerCallback(); return this }, update: function () { var millis = Math.max(0, this.options.date.getTime() - new Date().getTime()), time = Math.floor(millis / 1000), stop = time == 0, countdown = { days: Math.floor(time / (60 * 60 * 24)), time: time, millis: millis }; time %= (60 * 60 * 24); countdown.hours = Math.floor(time / (60 * 60)); time %= (60 * 60); countdown.minutes = Math.floor(time / 60); countdown.second = time % 60; this.fireEvent('onChange', countdown); if(stop) { this.timer.stop(); this.fireEvent('onComplete'); } } }); function buy_quantity_sum(obj,span_id) { to_num(obj); if(obj.value=='' || !(obj.value.toInt()>0)) qua=1; else qua=obj.value; var f=getId('price_produsts_info'); var fonts = f.getElementsByTagName('font'); f.className='view_price_shipping'; var arr = new Array(); var counter=0; var curr; for(var j=0; j0) mySlide.set(0); href=$('link_img_main').href; var src=$('img_main').src.replace(/thumb\/([^\/]+)\/([^\/]+)\/([^\/]+)\//, "thumb/242/0/0/"); var zimg = Asset.images([src], { onComplete: function(){ sv=Math.floor((zimg[0].width/$('image_zamk').getStyle('width').toInt()))*80; mySlide.steps=sv; } }); } } function check_com(f) { var s=true; var inputs = f.getElementsByTagName('input'); for(var i=0; ircmax) rcmax=size.y; } }); $('rc-carousel-content-inner-'+box[3]).setStyle("height",rcmax); } }); }); function inventory(pid0,pict) { loading_start(); var val={}; val['opt1']={}; val['opt1'][0]={}; val['opt1'][1]={}; val['pict']=pict; if(!pict) var suff=''; else var suff=pict; var pid=getId('products_id'+suff).value; val['pid']=pid; if(pid0) val['pid0']=pid0; if($('inventory_opt_cont'+suff+'_'+pid)) { var f=getId('inventory_opt_cont'+suff+'_'+pid); var sels = f.getElementsByTagName('select'); for(var i=0; i0) Tabs1 = new mootabs('pinfoTabs', {changeTransition: 'none', mouseOverClass: 'over'}); } $$('.products_services_ev').each(function(el){ el.addEvents({ 'keyup': service_calc }); }); //zapytaj o produkt if ($('q_user_text')){ $('q_user_text').addEvent('click', function(e){ var rc_w=new rc_windows({ id:'rc_window3', container: $(document.body), useOverlay: true, width:600, height:300, title: 'Zapytaj o produkt', contentAJAX:'/ajax/question/index/'+$('products_id').get('value')+'/', onComplete: function(){ $(rc_w.options.id+'_title').set('html',$(rc_w.options.id+'_title').get('html')+' - '+$('qproduct_title').get('html')); var exV = new fValidator("q_user", { 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: "question_bt", fValidate_send:function(){ $('q_user').set('send', {onComplete: function(data) { rc_w.close_window(); salert('Twoje zapytanie zostało wysłane',5000,false,false,'none'); // definicja! close_window_out($('rc_window3'),1,5000); }}); $('q_user').send(); } }); } }); }); } $$('[id^=n_user_text]').each(function(el,i){ el.addEvent('click', function(e){ var pid=0; if ($('products_id')) pid=$('products_id').get('value'); else { var p1=el.id.split('-'); pid=p1[1]; } var rc_w=new rc_windows({ id:'rc_window7', container: $(document.body), useOverlay: true, width:600, height:300, title: 'Negocjuj cenę', contentAJAX:'/ajax/question/index/'+pid+'&t=1/', onComplete: function(){ $(rc_w.options.id+'_title').set('html',$(rc_w.options.id+'_title').get('html')+' - '+$('qproduct_title').get('html')); var exV = new fValidator("q_user", { 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: "question_bt", fValidate_send:function(){ $('q_user').set('send', {onComplete: function(data) { rc_w.close_window(); salert('Twoje zapytanie zostało wysłane',5000,false,false,'none'); // definicja! close_window_out($('rc_window3'),1,5000); }}); $('q_user').send(); } }); } }); }); }); //polec znajomemu if ($('send_friend_text')){ $('send_friend_text').addEvent('click', function(e){ var rc_w=new rc_windows({ id:'rc_window4', container: $(document.body), useOverlay: true, width:600, height:300, title: 'Poleć znajomemu', contentAJAX:'/ajax/send_friend/index/'+$('products_id').get('value')+'/', onComplete: function(){ $(rc_w.options.id+'_title').set('html',$(rc_w.options.id+'_title').get('html')+' - '+$('sproduct_title').get('html')); var exV = new fValidator("s_friend", { 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: "send_friend_bt", fValidate_send:function(){ $('s_friend').set('send', {onComplete: function(data) { rc_w.close_window(); salert('Twoja wiadomość została wysłana',5000,false,false,'none'); // definicja! close_window_out($('rc_window4'),1,5000); }}); $('s_friend').send(); } }); } }); }); } //wydrukuj strone if ($('print_page')){ $('print_page').addEvent('click', function(e){ var rc_w=new rc_windows({ id:'rc_window5', container: $(document.body), useOverlay: true, width:800, height:300, title: 'Wydrukuj stronę', contentAJAX:'/ajax/pinfo/print_page/'+$('products_id').get('value')+'/', onComplete: function() { $(rc_w.options.id+'_title').set('html',$(rc_w.options.id+'_title').get('html')+' - '+$('sproduct_title').get('html')); } }); }); } //rate if ($('send_rate')){ $('send_rate').addEvent('click', function(e){ var rc_w=new rc_windows({ id:'rc_window5', container: $(document.body), useOverlay: true, width:800, height:300, title: 'Napisz opinię', contentAJAX:'/ajax/pinfo/send_rate/'+$('products_id').get('value')+'/', onComplete: function() { $(rc_w.options.id+'_title').set('html',$(rc_w.options.id+'_title').get('html')); } }); }); } }); window.addEvent('load', function() { //searcher add_cart_event(); //end searcher var u=0; if($('area')) { width=$('img_main').width; height=$('img_main').height; $('link_img_main').style.marginBottom=0; $('link_img_main').style.marginRight=0; href=$('link_img_main').href; //ustawienie boxów var myEffect1 = new Fx.Morph('image_zamk', {duration: 1000, transition: Fx.Transitions.Sine.easeOut}); myEffect1.start({ 'height': [$('image_zamk').getStyle('height'), $('img_main').height], 'width': [$('image_zamk').getStyle('width'), $('img_main').width] }); var myEffect2 = new Fx.Morph('zamk', {duration: 1000, transition: Fx.Transitions.Sine.easeOut}); myEffect2.start({ 'height': [$('zamk').getStyle('height'), $('img_main').height], 'width': [$('zamk').getStyle('width'), $('img_main').width] }); if(!Browser.Engine.trident) { var myEffect89 = new Fx.Morph('image_zamk', {duration: 1000, transition: Fx.Transitions.Sine.easeOut}); var pos=(($('area').getStyle('width').toInt()+64)-$('img_main').width)/2; myEffect89.start({ 'left': [0, pos] }); } $('zoom_but_rigth').addEvent('click', function(e){ if((mySlide.step+(mySlide.steps*0.10))<= mySlide.steps) { mySlide.set(mySlide.step+(mySlide.steps*0.10)); } else { mySlide.set(mySlide.steps); } }); $('zoom_but_left').addEvent('click', function(e){ if((mySlide.step-(mySlide.steps*0.10))>=0) { mySlide.set(mySlide.step-(mySlide.steps*0.10)); } else { mySlide.set(0); } }); //end var start=0; mySlide = new Slider($('area'), $('knob'), { steps: 160, onComplete: function(step){ if(start==1) { if(step>0) { if(flagi==0) { href=$('link_img_main').href; loading_start(); var src=$('img_main').src.replace(/thumb\/([^\/]+)\/([^\/]+)\/([^\/]+)\//, "thumb/242/0/0/"); var zimg = Asset.images([src], { onComplete: function(){ $('img_main').src =src; sv=Math.floor((zimg[0].width/width))*80; mySlide.steps=sv; loading_stop(); } }); flagi=1; } $('link_img_main').removeEvents('click'); $('link_img_main').href="javascript:void(0);"; $('img_main').style.cursor="move"; } } else start=1; if(step==0) { $('img_main').style.cursor="hand"; $('img_main').style.cursor="pointer"; if(u==1) { $('link_img_main').href=href; omb.content.each(function(el,i){ $('link_img_main').addEvent('click', function(e){ var myTarget = ($(e.target).match('a')) ? $(e.target) : $(e.target).getParent('a'); e.preventDefault(); //images sort var ile=omb.options.start_array.length; for(var ii=0; ii2) { if($('image_'+tab[3])) { var img=$('image_'+tab[3]).innerHTML; if(img!='') { if($('rc_window_opt') && 1==0) { Sekcja=document.getElementById('rc_window_opt'); table=Sekcja.getElementsByTagName('table'); td=table[0].getElementsByTagName('td'); img=td[0].getElementsByTagName('img'); var image=$('image_'+tab[3]).innerHTML; img[0].src='http://photos04.redcart.pl/templates/images/thumb/242/250/250/pl/0/templates/images/products/242/'+image; } else { // var zimg = Asset.images([$('img_main').get('src')], {}); // var height=zimg[0].height; // var width=zimg[0].width; var thumb = $('img_main').get('src').split('thumb'); thumb = thumb[1].split('/'); var height=thumb[2]; var width=thumb[2]; var tobj={}; tobj.src='http://photos04.redcart.pl/templates/images/thumb/242/'+width+'/'+height+'/pl/0/templates/images/products/242/'+img; link=tobj.src; $$('.m_pinfo_mini_img').each(function(el,i){ image=el.getElementsByTagName('img'); if(image[0].src.match(img)) { // link='/ajax/pinfo/gallery/'+($('products_id').value)+'/'+i+'/'; link=image[0].src; link=link.replace(/thumb\/([^\/]+)\/([^\/]+)\/([^\/]+)\//, "thumb/$1/0/0/"); tobj=image[0]; image[0].click(); } }); //change_main_img(tobj,link,width,height); } } } } } function inform_window(products_id,timeout) { if(timeout==0) var title='Powiadom mnie o dostępności'; if(timeout==1) var title='Poinformuj mnie gdy cena osiągnie określoną wartość'; new rc_windows({ id:'rc_window5', container: $(document.body), useOverlay: true, width:800, height:300, title: title, varAJAX: {"timeout":timeout}, contentAJAX:'/ajax/pinfo/products_inform/'+products_id+'/' }); } window.addEvent('load',function(){ $$('[id^=small_cutdown]').each(function(el,i){ tab = el.id.split('_'); var countdown = new CountDown({ date: new Date(Math.round($('promotion_over_'+tab[2]).get('html'))*1000), frequency: 100, onChange: function(counter) { var text = ''; var def_day='dzień'; var def_days='dni'; if(counter.days == 1) var dday=def_day; else var dday=def_days; if(counter.days > 0) text = counter.days + ' '+dday+' '; if(counter.hours > 9 && counter.hours!=9) var z=''; else var z='0'; text += z+counter.hours+':'; if(counter.minutes > 9 && counter.minutes!=9) var z=''; else var z='0'; text += z+counter.minutes+':'; if(counter.second > 9 && counter.second!=9) var z=''; else var z='0'; text += z+counter.second; el.set('html', text) }, onComplete: function () { // window.location.reload(); } }); countdown.start(); }); }); function timeout_window(id,title) { new rc_windows({ id:'rc_window55', container: $(document.body), useOverlay: true, width:800, height:300, title: title, contentHTML: $('timeout_information_'+id).get('html') }); }