window.addEvent('domready', function() { if($$('#box_anims div[class=box_anim_container]').length>0) { var nS = new noobSlide({ box: $('box_anims'), items: $$('#box_anims div[class=box_anim_container]'), size: 555, mode: 'horizontal', modes: {horizontal:['left','width']}, interval:5000, autoPlay: true, fxOptions: { duration: 4000, transition: Fx.Transitions.Quint.easeInOut }, onWalk: function(currentItem,currentHandle){ }, addButtons: { previous: $('anim_prev'), next: $('anim_next') } }); $$('.buttons').each(function(el,i){ el.addEvent(nS.button_event,nS.stop.bind(nS)); },nS); } $$('.rc_start_categories').each(function(el){ var mX; var mY; var id; el.addEvent('click',function(event){ id=el.id.replace('categories',''); var scroll = document.getScroll(); mX = event.page.x-scroll.x; mY = event.page.y-scroll.y; getId('absolute_categories').innerHTML=' '; var req = new Request({ method: 'post', url: 'ajax.php?p=start&f=categories', data:{"id": id, "id_home": id}, onComplete: function(data) { var response = data; getId('absolute_categories').innerHTML=response; if(el!='absolute_categories') { $('absolute_categories').style.left= mX+'px'; $('absolute_categories').style.top= mY+'px'; $('absolute_categories').style.display='block'; var my_size=$('absolute_categories').getSize(); if((mY+my_size.y)>window.getHeight()) { mY=window.getHeight()-my_size.y; mY-10; $('absolute_categories').style.top= mY+'px'; } if((mX+my_size.x)>window.getWidth()) { mX=window.getWidth()-my_size.x; mX-10; $('absolute_categories').style.left= mX+'px'; } $('absolute_categories_bottom').width=my_size.x; } } }).send(); }); }); if($('absolute_categories')) { var myDrag = new Drag.Move('absolute_categories', { onDrop: function(element, droppable, event){ // if (!droppable) console.log(element, ' dropped on nothing'); // else console.log(element, 'dropped on', droppable, 'event', event); }, onEnter: function(element, droppable){ // console.log(element, 'entered', droppable); }, onLeave: function(element, droppable){ //console.log(element, 'left', droppable); } }); } }); window.addEvent('load', function() { $$('[id^=producers_rotator_c_]').each(function(el){ var id=el.get('id').replace('producers_rotator_c_',''); var size_c = $('producers_rotator_c_'+id).getSize(); var size = $('producers_rotator_'+id).getSize(); if(size.x>size_c.x) { var time=0; time=size.x-($('producers_rotator_'+id).getStyle('left').toInt()*(-1)); var newSize=size.x-size_c.x; $('producers_rotator_'+id).set('tween', { duration: time*10, transition: 'linear', link: 'cancel', onComplete:function(){ if($('producers_rotator_'+id).getStyle('left').toInt()==(-(newSize))) $('producers_rotator_'+id).tween('left', -(newSize), 0); else $('producers_rotator_'+id).tween('left', 0, -(newSize)); } }); $('producers_rotator_'+id).tween('left', 0, -(newSize)); if($('producers_rotator_left_'+id)) $('producers_rotator_left_'+id).addEvent('mouseover',function(){ var size = $('producers_rotator_'+id).getSize(); var size_c = $('producers_rotator_c_'+id).getSize(); time=(size.x)-($('producers_rotator_'+id).getStyle('left').toInt()*(-1)); $('producers_rotator_'+id).set('tween', { duration: time, transition: 'linear', link: 'cancel', onComplete:function(){ $('producers_rotator_'+id).get('tween').pause(); } }); $('producers_rotator_'+id).tween('left', $('producers_rotator_'+id).getStyle('left').toInt(),-(size.x-size_c.x)); }); if($('producers_rotator_left_'+id)) $('producers_rotator_left_'+id).addEvent('mouseout',function(){ var size = $('producers_rotator_'+id).getSize(); var size_c = $('producers_rotator_c_'+id).getSize(); time=$('producers_rotator_'+id).getStyle('left').toInt()*(-1); var poz=$('producers_rotator_'+id).getStyle('left').toInt()*(-1); if(poz==(size.x-size_c.x)) time=(size.x-size_c.x); else time=(size.x-size_c.x)-poz; $('producers_rotator_'+id).set('tween', { duration: time*10, transition: 'linear', link: 'cancel', onComplete:function(){ } }); $('producers_rotator_'+id).tween('left', -(size.x-size_c.x),0); }); //prawa if( $('producers_rotator_right_'+id)) $('producers_rotator_right_'+id).addEvent('mouseover',function(){ var size = $('producers_rotator_'+id).getSize(); var size_c = $('producers_rotator_c_'+id).getSize(); time=$('producers_rotator_'+id).getStyle('left').toInt()*(-1); $('producers_rotator_'+id).set('tween', { duration: time, transition: 'linear', link: 'cancel', onComplete:function(){ $('producers_rotator_'+id).get('tween').pause(); } }); $('producers_rotator_'+id).tween('left', $('producers_rotator_'+id).getStyle('left').toInt(),0); }); if( $('producers_rotator_right_'+id)) $('producers_rotator_right_'+id).addEvent('mouseout',function(){ var size = $('producers_rotator_'+id).getSize(); var size_c = $('producers_rotator_c_'+id).getSize(); var poz=$('producers_rotator_'+id).getStyle('left').toInt()*(-1); if(poz==0) time=(size.x-size_c.x); else time=poz; $('producers_rotator_'+id).set('tween', { duration: time*10, transition: 'linear', link: 'cancel', onComplete:function(){ } }); $('producers_rotator_'+id).tween('left', 0,-(size.x-size_c.x)); }); $('producers_rotator_'+id).addEvent('mouseover',function(){ $('producers_rotator_'+id).get('tween').pause(); }); $('producers_rotator_'+id).addEvent('mouseout',function(){ $('producers_rotator_'+id).get('tween').resume(); }); } }); }); function open_categories(id,id_home) { getId('absolute_categories').innerHTML=' '; var req = new Request({ method: 'post', url: 'ajax.php?p=start&f=categories', data:{"id": id,"id_home": id_home}, onComplete: function(data) { var response = data; getId('absolute_categories').innerHTML=response; var my_size=$('absolute_categories').getSize(); if(($('absolute_categories').getStyle('top').toInt()+my_size.y)>window.getHeight()) { mY=window.getHeight()-my_size.y; mY-10; $('absolute_categories').style.top= mY+'px'; } if(($('absolute_categories').getStyle('left').toInt()+my_size.x)>window.getWidth()) { mX=window.getWidth()-my_size.x; mX-10; $('absolute_categories').style.left= mX+'px'; } $('absolute_categories_bottom').width=my_size.x; } }).send(); } function timeout(id,newdate,interval,interval_now) { if(interval_now!=interval) interval_use=interval_now; else interval_use=interval; var bgcolor=$('countdown_'+id).getStyle('background-color'); var fontcolor=$('countdown_'+id).getStyle('color'); var countdown = new CountDown({ date: new Date(newdate.getTime()+(interval_use*1000)), frequency: 100, onChange: function(counter) { var text = ''; 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; if(counter.minutes == 0 && counter.second<10) { if($('countdown_'+id)) { $('countdown_'+id).setStyle('color','#ffffff'); $('countdown_'+id).setStyle('background-color','#ff0000'); $('countdown_'+id).addClass('countdown-alert'); if($('countdown_mobile_'+id)) $('countdown_mobile_'+id).addClass('countdown-alert'); } // var myFx = new Fx.Tween($('countdown_'+id), { // duration: 1000, // transition: 'sine:in', // link: 'cancel', // property: 'font-size' // }); // myFx.start(25, 15); } if($('countdown_'+id)) $('countdown_'+id).set('html', text); if($('countdown_mobile_'+id)) $('countdown_mobile_'+id).set('html', text); }, onComplete: function () { var req = new Request({ method: 'post', url: 'ajax.php?p=start&f=timeout', data:{"id_home":id,"type":'none'}, onComplete: function(data) { var response = data; if(response>0) { console.log(data); if($('timeout_container_'+response)) $('timeout_container_'+response).dispose(); } else { var myFx = new Fx.Tween('timeout_price_'+id, { duration: 1000, transition: 'sine:out', link: 'cancel', property: 'opacity' }); myFx.start('0','1'); $('timeout_price_'+id).set('html', response); (function(){ myFx.start('0','1');}).delay(1000); (function(){ myFx.start('0','1');}).delay(2000); } } }).send(); var da=new Date(); if($('countdown_'+id)) { $('countdown_'+id).setStyle('color',fontcolor); $('countdown_'+id).setStyle('background-color',bgcolor); $('countdown_'+id).removeClass('countdown-alert'); if($('countdown_mobile_'+id)) $('countdown_mobile_'+id).removeClass('countdown-alert'); timeout(id,da,interval,interval); } } }); } function quickView() { $$('.qv-button').addEvent('click', function(){ var pid = $(this).get('data-id'); var rc_w=new rc_windows({ id:'brief_'+pid, container: $(document.body), useOverlay: true, varAJAX: {"pid":pid}, contentAJAX:'_HOST_PATHajax.php?p=pinfo&f=get_brief&products_id=' + pid, width:900, head: true, onComplete: function(){ inventory(pid); $$('a.gallery-main.').addEvent('click', function(e) { e.stop(); $('img_main').set('src',$(this).get('href')); var datasrc = $(this).getElements('img')[0].get('data-src'); $('img_main').set('data-src',datasrc); $('link_img_main').set('href',datasrc); }) add_cart_pinfo_new(); rc3Event(); jQuery("a.slideHref").fancybox(); jQuery('#thumbs .thumb a').each(function(i) { jQuery(this).addClass( 'itm'+i ); }); jQuery('#thumbs a.itm0').addClass( 'selected' ); jQuery('#thumbs').carouFredSel({ direction: 'left', responsive: true, circular: false, infinite: false, items: 3, align: false, auto: false, prev: '#prev', next: '#next' }); } }); }) } window.addEvent('domready', function() { quickView(); });