if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(searchElement /*, fromIndex */) { "use strict"; if (this === void 0 || this === null) throw new TypeError(); var t = Object(this); var len = t.length >>> 0; if (len === 0) return -1; var n = 0; if (arguments.length > 0) { n = Number(arguments[1]); if (n !== n) // shortcut for verifying if it's NaN n = 0; else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) n = (n > 0 || -1) * Math.floor(Math.abs(n)); } if (n >= len) return -1; var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); for (; k < len; k++) { if (k in t && t[k] === searchElement) return k; } return -1; }; } var Shop = { start : function(){ if($('sliderGallery')) Shop.makeScrollbar( $('sliderGallery'), $('slider'), $('handle'), true ); if($('browser')) Shop.loadBrowser(); if (!Browser.Engine.trident) { if($('cartselect')) Shop.initPrice(); Shop.Tiptoes(); } else { if(Browser.ie) { if(Browser.ie9) { if($('cartselect')) Shop.initPrice(); } else { if(Browser.ie7 || Browser.ie8) { Shop.Tiptoes(); } if($('cartselect') && $('selcountry')){ dynSelect('selcountry', 'itemid', 'specs'); } } } /* console.log(Browser.Engine); if(Browser.Engine.trident5) { } else { if (!Browser.Engine.trident4) { Shop.Tiptoes(); } if($('cartselect') && $('selcountry')){ } } */ } Shop.setUpScrollAnchors(); if($('btn_buy')) Shop.prebuy(); //if($$('.cartdelete')) Shop.RemoveCartLine(); SqueezeBox.assign($$('a.squickboxed'), { parse : 'rel' }); }, initFlash : function(url, width, height) { if (Browser.Plugins.Flash.version <8) { $('checkFlash').set('html', 'Upgrade your flash player'); $('checkFlash').addClass('warn'); $('linkFlash').addEvent('click', function(e) { e.stop(); $('checkFlash').setStyles({'font-size': '110%', 'color':'#fff'}); }); } else { SqueezeBox.assign($$('a.flashboxed'), { parse : 'rel' }); var so= new Swiff (url, { id:'preflash', width:width, height:height, container: $('previewer'), params : { wmode: 'transparent' } }); } }, PlayFlash : function (url, width, height) { if (Browser.Plugins.Flash.version <8) { $('checkFlash').set('html', 'Upgrade your flash player'); $('checkFlash').addClass('warn'); $('linkFlash').addEvent('click', function(e) { e.stop(); $('checkFlash').setStyles({'font-size': '110%', 'color':'#fff'}); }); } else { $('loadFlash').addEvent('click', function() { var so2= new Swiff (url, { id:'flashzoom', width:width, height:height, container: $('viewer'), params : { wmode: 'transparent', bgcolor:'#2b2c2b' } }); }); } }, PlayQuick : function (url, width, height) { $$('a.').addEvent('click', function() { var so2= new sQuick (url, { id:'quickzoom', width:194, height:515, container: $('viewer'), messenger: $('checkQuick'), params : { autostart: 'true', src: url, controller: 'true' } }); }); }, setUpScrollAnchors: function(){ $$('a.scroollers').each(function(lnk) { if(lnk.href.test("#")) { lnk.addEvent('click', function(){ this.scrollTo(lnk.href.split('#')[1]); }.bind(this)); } }, this); }, Load: function() { this.initialize(); this.element = $(el); if (this.element && this.element.rel) options = $merge(options || {}, Json.evaluate(this.element.rel)); this.setOptions(this.presets, options); this.assignOptions(); this.url = (this.element ? (this.options.url || this.element.href) : el) || ''; if (this.options.handler) { var handler = this.options.handler; return this.setContent(handler, this.parsers[handler].call(this, true)); } var res = false; for (var key in this.parsers) { if ((res = this.parsers[key].call(this))) return this.setContent(key, res); } return this; }, Tiptoes : function() { var regExpressionNonObj= /;;/g; $$('a.tipz').each(function(element,index) { var content=element.get('title'); if(content) { var content=content.replace(regExpressionNonObj, '
'); var content = content.split('::'); element.store('tip:title', content[0]); element.store('tip:text', content[1]); } }); //create the tooltips var tipz = new Tips('.tipz',{ className: 'tipz', fixed: false, offset:{'x':10, 'y':-120}, hideDelay: 50, showDelay: 50 }); tipz.addEvents({ 'show': function(tip) { tip.fade('in'); }, 'hide': function(tip) { tip.fade('out'); } }); }, FadeAllFins :function() { //init or if step 0 var fins = $$("#sliderGallery li img"); fins.each(function(el, i){ el.fade(0.8); }, this); }, LightFins:function(position) { //console.log(position) var formulas = $$("#sliderGallery li img.formula"); var freeraces = $$("#sliderGallery li img.freerace"); var slaloms = $$("#sliderGallery li img.slalom"); var speeds = $$("#sliderGallery li img.speed"); var bumps = $$("#sliderGallery li img.bump"); var freestyles = $$("#sliderGallery li img.freestyle"); var waves = $$("#sliderGallery li img.wave"); var antiweeds = $$("#sliderGallery li img.antiweed"); // first fade all fins // Shop.FadeAllFins(); // then light fins according to position // formulas if( position < 80) { var thisformula=$$(".formula"); var fifties = $$("#sliderGallery li img.formula.freerace"); //console.log(fifties); var freeraces = $$("#sliderGallery li img.freerace"); freeraces.each(function(el, i){ el.fade(0.8); }, this); formulas.each(function(el, i){ el.fade(1); el.morph('.formula-hover'); }, this); } // freerace middle pos=253 if(position >= 80 && position < 255) { formulas.each(function(el, i){ el.fade(0.8); el.morph('.formula'); }, this); freeraces.each(function(el, i){ el.fade(1); el.morph('.freerace-hover'); }, this); } // slalom middle pos=667 if(position >= 255 && position < 480) { formulas.each(function(el, i){ el.morph('.formula'); el.fade(0.8); }, this); freeraces.each(function(el, i){ el.morph('.freerace'); el.fade(0.8); }, this); speeds.each(function(el, i){ el.morph('.speed'); el.fade(0.8); }, this); slaloms.each(function(el, i){ el.morph('.slalom-hover'); el.fade(1); }, this); } // speed middle pos=970 if(position >= 480 && position < 720) { formulas.each(function(el, i){ el.morph('.formula'); el.fade(0.8); }, this); freeraces.each(function(el, i){ el.morph('.freerace'); el.fade(0.8); }, this); slaloms.each(function(el, i){ el.morph('.slalom'); el.fade(0.8); }, this); speeds.each(function(el, i){ el.morph('.speed-hover'); el.fade(1); }, this); } // bump middle pos=1516 if(position>720 && position<=810 ) { formulas.each(function(el, i){ el.morph('.formula'); el.fade(0.8); }, this); freeraces.each(function(el, i){ el.morph('.freerace'); el.fade(0.8); }, this); slaloms.each(function(el, i){ el.morph('.slalom'); el.fade(0.8); }, this); speeds.each(function(el, i){ el.morph('.speed'); el.fade(0.8); }, this); freestyles.each(function(el, i){ el.fade(0.8); el.morph('.freestyle'); }, this); waves.each(function(el, i){ el.fade(0.8); el.morph('.wave'); }, this); antiweeds.each(function(el, i){ el.fade(0.8); el.morph('.antiweed'); }, this); bumps.each(function(el, i){ el.fade(1); el.morph('.bump-hover'); }, this); } // freestyl middle pos=1734 if(position>810 && position<=980 ) { formulas.each(function(el, i){ el.morph('.formula'); el.fade(0.8); }, this); freeraces.each(function(el, i){ el.morph('.freerace'); el.fade(0.8); }, this); slaloms.each(function(el, i){ el.morph('.slalom'); el.fade(0.8); }, this); speeds.each(function(el, i){ el.morph('.speed'); el.fade(0.8); }, this); bumps.each(function(el, i){ el.fade(0.8); el.morph('.bump'); }, this); waves.each(function(el, i){ el.fade(0.8); el.morph('.wave'); }, this); antiweeds.each(function(el, i){ el.fade(0.8); el.morph('.antiweed'); }, this); freestyles.each(function(el, i){ el.fade(1); el.morph('.freestyle-hover'); }, this); } // wave if(position>980 && position<=1150 ) { formulas.each(function(el, i){ el.morph('.formula'); el.fade(0.8); }, this); freeraces.each(function(el, i){ el.morph('.freerace'); el.fade(0.8); }, this); slaloms.each(function(el, i){ el.morph('.slalom'); el.fade(0.8); }, this); speeds.each(function(el, i){ el.morph('.speed'); el.fade(0.8); }, this); bumps.each(function(el, i){ el.fade(0.8); el.morph('.bump'); }, this); freestyles.each(function(el, i){ el.fade(0.8); el.morph('.freestyle'); }, this); waves.each(function(el, i){ el.fade(1); el.morph('.wave-hover'); }, this); antiweeds.each(function(el, i){ el.fade(0.8); el.morph('.antiweed'); }, this); } // wave if(position>1150 ) { formulas.each(function(el, i){ el.morph('.formula'); el.fade(0.8); }, this); freeraces.each(function(el, i){ el.morph('.freerace'); el.fade(0.8); }, this); slaloms.each(function(el, i){ el.morph('.slalom'); el.fade(0.8); }, this); speeds.each(function(el, i){ el.morph('.speed'); el.fade(0.8); }, this); bumps.each(function(el, i){ el.fade(0.8); el.morph('.bump'); }, this); freestyles.each(function(el, i){ el.fade(0.8); el.morph('.freestyle'); }, this); waves.each(function(el, i){ el.fade(0.8); el.morph('.wave-hover'); }, this); antiweeds.each(function(el, i){ el.fade(1); el.morph('.antiweed'); }, this); } /* */ }, makeScrollbar :function(content,scrollbar,handle,horizontal,ignoreMouse){ //var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y)) //var steps = getScrollSize($('sliderGallery ul')).x ; //var steps = 1482 ; // let's deal with this damned IE6 //var steps = 1475 ; var steps = 1505 ; var slider = new Slider(scrollbar, handle, { steps: steps, mode: (horizontal?'horizontal':'vertical'), onChange: function(step){ // Scrolls the content element in x or y direction. var x = (horizontal?step:0); var y = (horizontal?0:step); //console.log(x); content.scrollTo(x,y); if (!Browser.Engine.trident4) { Shop.FadeAllFins(); Shop.LightFins(x); } } }).set(0); if( !(ignoreMouse) ){ // Scroll the content element when the mousewheel is used within the // content or the scrollbar element. $$(content, scrollbar).addEvent('mousewheel', function(e){ e = new Event(e).stop(); var step = slider.step - e.wheel * 30; slider.set(step); }); } // Stops the handle dragging process when the mouse leaves the document body. $(document.body).addEvent('mouseleave',function(){slider.drag.stop()}); var programs = $$("#slider span"); var autostep= 0; var slideformula = new Fx.Tween($('slider-formula')); var slidefreerace = new Fx.Tween($('slider-freerace')); var slideslalom = new Fx.Tween($('slider-slalom')); var slidespeed = new Fx.Tween($('slider-speed')); var slidebump = new Fx.Tween($('slider-bump')); var slidefreestyle = new Fx.Tween($('slider-freestyle')); var slidewave = new Fx.Tween($('slider-wave')); $('slider-formula').addEvent('click', function(e) { // We change the background-color of the element slideformula.start('color', '#003366'); slidefreerace.start('color', '#fff'); slideslalom.start('color', '#fff'); slidespeed.start('color', '#fff'); slidebump.start('color', '#fff'); slidefreestyle.start('color', '#fff'); slidewave.start('color', '#fff'); }); $('slider-freerace').addEvent('click', function(e) { // We change the background-color of the element slideformula.start('color', '#fff'); slidefreerace.start('color', '#0A284F'); slideslalom.start('color', '#fff'); slidespeed.start('color', '#fff'); slidebump.start('color', '#fff'); slidefreestyle.start('color', '#fff'); slidewave.start('color', '#fff'); }); $('slider-slalom').addEvent('click', function(e) { // We change the background-color of the element slideformula.start('color', '#fff'); slidefreerace.start('color', '#fff'); slideslalom.start('color', '#1555A1'); slidespeed.start('color', '#fff'); slidebump.start('color', '#fff'); slidefreestyle.start('color', '#fff'); slidewave.start('color', '#fff'); }); $('slider-speed').addEvent('click', function(e) { // We change the background-color of the element slideformula.start('color', '#fff'); slidefreerace.start('color', '#fff'); slideslalom.start('color', '#fff'); slidespeed.start('color', '#12155A'); slidebump.start('color', '#fff'); slidefreestyle.start('color', '#fff'); slidewave.start('color', '#fff'); }); $('slider-bump').addEvent('click', function(e) { // We change the background-color of the element slideformula.start('color', '#fff'); slidefreerace.start('color', '#fff'); slideslalom.start('color', '#fff'); slidespeed.start('color', '#fff'); slidebump.start('color', '#E56B12'); slidefreestyle.start('color', '#fff'); slidewave.start('color', '#fff'); }); $('slider-freestyle').addEvent('click', function(e) { // We change the background-color of the element slideformula.start('color', '#fff'); slidefreerace.start('color', '#fff'); slideslalom.start('color', '#fff'); slidespeed.start('color', '#fff'); slidebump.start('color', '#fff'); slidefreestyle.start('color', '#F3A416'); slidewave.start('color', '#fff'); }); $('slider-wave').addEvent('click', function(e) { // We change the background-color of the element slideformula.start('color', '#fff'); slidefreerace.start('color', '#fff'); slideslalom.start('color', '#fff'); slidespeed.start('color', '#fff'); slidebump.start('color', '#fff'); slidefreestyle.start('color', '#fff'); slidewave.start('color', '#FCD718'); }); /* programs.each(function(el, i){ if (programs.hasClass('slider-formula')) autostep=0; if (programs.hasClass('slider-freerace')) autostep=229; if (programs.hasClass('slider-slalom')) autostep=525; if (programs.hasClass('slider-speed')) autostep=682; if (programs.hasClass('slider-sx')) autostep=806; if (programs.hasClass('slider-bump')) autostep=942; if (programs.hasClass('slider-freestyle')) autostep=1152; if (programs.hasClass('slider-wave')) autostep=1352; el.addEvent('click', function(e) { slider.set(autostep); }); }, this); */ }, CartAccept:function() { var acceptlbl=$('accept'); var is_checked=$('acceptance').checked; if(is_checked == false) { alert('Vous devez accepter les conditions de vente.'); return false; } else { $('lost').submit(); } }, UpdatePrice : function(countryval, items, specs, itemoptions, specoptions) { // let's write the php euro list var expeuro = $('zoneuro'), expworld = $('zoneworld'); var listeuro = new Array('DE','AT','BE','ES','FI','FR','GR','IE','IT','LU','NL','PT','HU','PL','CY','CZ','DK','LV','GB','LT','SK','EE','SI','MT','SE','MC'); var i, j; // let's init the list to the single first option for(i=(itemoptions.length - 1); i>=1; i--){ items.remove(i); } for(j=(specoptions.length - 1); j>=1; j--){ specs.remove(j); } if(countryval==0) { expeuro.setStyles({'display' : 'none', 'opacity': 0}); expworld.setStyles({'display' : 'none', 'opacity': 0}); for (var i = 0; i < itemoptions.length; i++) { if (itemoptions[i].hasClass('select')) { // Clone the option from the hidden option pool and append it to the dynamic select box items.appendChild(itemoptions[i].cloneNode(true)); } } for (var j = 0; j < specoptions.length; j++) { if (specoptions[j].hasClass('select')) { // Clone the option from the hidden option pool and append it to the dynamic select box specs.appendChild(specoptions[j].cloneNode(true)); } } } else { // let's inject according to country if (new RegExp('^(' + listeuro.join('|') + ')$').test(countryval)) { expworld.setStyles({'display' : 'none', 'opacity': 0}); expeuro.setStyles({'display' : 'block', 'opacity': 1}); for (var i = 0; i < itemoptions.length; i++) { if (itemoptions[i].hasClass('euro')) { // Clone the option from the hidden option pool and append it to the dynamic select box //items.appendChild(itemoptions[i].cloneNode(true)); items.grab(itemoptions[i].clone().setStyles({'display':'block', 'visibility':'visible', 'color':'#000'})); //console.log(itemoptions[i].clone()); } } for (var j = 0; j < specoptions.length; j++) { if (specoptions[j].hasClass('euro')) { // Clone the option from the hidden option pool and append it to the dynamic select box //specs.appendChild(specoptions[j].cloneNode(true)); specs.grab(specoptions[j].clone()); } } // let's display the right notes about price } else { expeuro.setStyles({'display' : 'none', 'opacity': 0}); expworld.setStyles({'display' : 'block', 'opacity': 1}); for (var i = 0; i < itemoptions.length; i++) { if (itemoptions[i].hasClass('world')) { // Clone the option from the hidden option pool and append it to the dynamic select box //items.appendChild(itemoptions[i].cloneNode(true)); items.grab(itemoptions[i].clone()); } } for (var j = 0; j < specoptions.length; j++) { if (specoptions[j].hasClass('world')) { // Clone the option from the hidden option pool and append it to the dynamic select box //specs.appendChild(specoptions[j].cloneNode(true)); specs.grab(specoptions[j].clone()); } } } } }, initPrice : function() { var items = $('itemid'), specs = $('specs'), itemoptions=items.getElements('option'), specoptions=specs.getElements('option'); var selects = $('cartchooser').getElements('select'); if(selects[0].id=='selcountry') { selects[0].addEvent('change', function(){ Shop.UpdatePrice(selects[0].value, items, specs, itemoptions, specoptions); }); // let's init the function on domready Shop.UpdatePrice(selects[0].value, items, specs, itemoptions, specoptions); } }, prebuy:function() { // let's first hide the network stuff... var formcart= $('formcart'), cartchooser=$('cartchooser'), buycontainer=$('buycontainer'), buys = $$(".buy"), discountries= new Array(); var netcountries=$('netcountryopts'), countselect=$('selcountry') ; // let's hide both retailers and online shop buycontainer.setStyle("opacity",0); buycontainer.setStyle("height",35); /* according to selected country 1 -> if part of unauthorized - display the reseller locator 2 -> if part of authorized do we have resellers ? 21 -> yes : display two options search for a reseller or buy online 22 -> no : display the buy online option */ // we first need to load unauthorized countries with php var ucountries = new Array('NC','NL','RU','UA','US'); // let's grab the netcountryopts and build a new array netcountries.getChildren('option').each(function(g) { if(g.value!=0) discountries.push(g.value); }) // if userdata already set countselect won't be there if($chk($('selcountry'))) { countselect.addEvent('change', function(){ var selcountry=countselect.getSelected(), displayos=false,displayres=false; if(selcountry[0].value==0) { } else { if(ucountries.length>0) { if(ucountries.indexOf(selcountry[0].value)>= 0) { // online shopping allowed displayos=false; if(discountries.indexOf(selcountry[0].value)>=0) { // we have some retailers... let's display the selector displayres=true; } else { displayres=false; } } else { displayos=true; if(discountries.indexOf(selcountry[0].value)>=0) { // we have some retailers... let's display the selector displayres=true; } else { displayres=false; } } } else { // no unauthorized displayos=true; if(discountries.indexOf(selcountry[0].value)>=0) { displayres=true; } else { displayres=false; } } // let's update the country field value for any forms $('country').set('value', selcountry[0].value); $('netcountry').set('value', selcountry[0].value); $('sltnetcountry').set('html', 'Revendeurs' + ' ' + selcountry[0].text); // hide the netcountries select netcountries.setStyle('display','none'); Shop.buy(displayos,displayres); } }); } else { var displayos=true, displayres=false; Shop.buy(displayos,displayres); } }, buy : function (displayos, displayres) { var formcart= $('formcart'), cartchooser=$('cartchooser'), buycontainer=$('buycontainer'), buys = $$(".buy"), buysolution=$('buysolution'); buysolution.setStyle('opacity',0); buysolution.setStyle('opacity',1); if(displayos===true && displayres===true) { $('resellers').setStyle('display','block'); $('buyonline').setStyle('display','block'); buysolution.set('html', 'Vous pouvez utiliser notre système de vente en ligne ou contacter votre magasin le plus proche.'); } else if(displayos===true && displayres===false) { $('resellers').setStyle('display','none'); $('buyonline').setStyle('display','block'); buysolution.set('html', 'Nous n\'avons pas de magasins dans votre pays. Veuillez utiliser notre système de vente en ligne.'); } else if(displayos===false && displayres===true) { $('buyonline').setStyle('display','none'); $('resellers').setStyle('display','block'); buysolution.set('html', 'Notre système de vente en ligne n\'est pas disponible depuis votre pays. Veuillez prendre contact avec votre magasin le plus proche.'); } buysolution.fade(1).highlight('#333', '#fff'); buycontainer.setStyle('opacity',1); buycontainer.setStyle('height','auto'); var reduceblock = new Fx.Morph(buycontainer, { duration: 1500, link: 'chain' }); var raisformcart = new Fx.Morph(formcart, { duration: 500, link: 'chain' }); // change height value according to countrylist ! var selects = $('cartselect').getElements('select'); if(selects[0].id=='country') { var raisheight=235; var buyheight=210; } else { var raisheight=175; var buyheight=110; } var ShowCart = new Fx.Morph(buycontainer, { duration: 750, link: 'chain', transition: 'quad:in', onStart: function() { // let's hide selector buyselector.setStyles({'height': '0', 'display':'none'}); buys.each(function(el, i){ el.fade(0); }, this); reduceblock.start({ opacity: [1, 0], height: [buycontainer.getStyle('height'), buyheight] }); }, onComplete: function() { buycontainer.setStyles({'height': '0', 'display':'none'}); formcart.setStyles({'height': raisheight,'opacity': '0', 'display':'block'}); raisformcart.start({ height: ['150', raisheight], opacity: [0, 1] }); } }); $('btn_buy').addEvent('click', function() { ShowCart.start(); }); }, loadBrowser : function() { var browsebutts = $$(".browslnk"); // let's get cart amount var rangebro=$('browser'); browsebutts.each(function(el, i){ el.addEvent('click', function(e) { e.stop(); var browuri=el.getProperty("href"); if (browuri.search('=')) browuri=browuri+'&ajax=true'; else browuri=browuri+'?ajax=true'; var initfx= new Fx.Morph($('browser'), { transition:Fx.Transitions.Quint.easeOut, duration:1000, link:'chain', onStart: function() { rangebro.addClass('loading'); rangebro.fade(0); } }); var playfx= new Fx.Morph($('browser'), { transition:Fx.Transitions.Quint.easeOut, duration:1000, link:'chain', onChainComplete: function() { // set style to browser // var divcont= new Element('div', {'id':'divcont', 'class':'browserange'}); var scrolleft= new Element('div', {'id':'scrolleft'}); var scrollright= new Element('div', {'id':'scrollright'}); rangebro.adopt(divcont); var req= new Request.HTML({ method: 'get', url : browuri, data: '' , update: divcont, evalScripts: true, onRequest : function () { rangebro.addClass('loading'); }, onComplete: function() { rangebro.removeClass('loading'); var myScroller = new Scroller(divcont, {area: 75, velocity: 1}); divcont.addEvent('mouseover', myScroller.start.bind(myScroller)); divcont.addEvent('mouseout', myScroller.stop.bind(myScroller)); if (!Browser.Engine.trident4) { Shop.Tiptoes(); } } }).send(); } }); initfx.start({ 'opacity' : [1,0], 'background-color': '#000' }).chain(function() { rangebro.empty(); playfx.start({ 'opacity' : [0,1], 'height' : [25, 260] }); }); }); }, this); }, AddtoCart : function(kind) { //console.log(kind); // we should build both product combo of prodid / itemid / combid /price // and we need to check if all elements needed are ok... if ($('prodid')) var prodid = $('prodid').value; if(kind=='fins') { var prodid= $('prodid'), itemid = $('itemid'), specs = $('specs'), country = $('country'); var itemide = true; var specse = true; if(country==null) { var countrye = true; } else { countrye=true; if(country.value==0) { country.addClass('warn'); countrye=false; } else { country.removeClass('warn'); countrye=true; } } if(itemid.value==0) { itemid.addClass('warn'); itemide=false; } else { itemid.removeClass('warn'); var itemide = true; } if(specs.value==0) { specs.addClass('warn'); specse=false; } else { specs.removeClass('warn'); specse=true; } if(!itemide || !specse || !countrye ) { return false; } else { // let's build specs... $('product').value=itemid.value+'/'+specs.value; $('cartselect').submit(); } } }, RemoveCartLine : function () { var rembutts = $$(".cartdelete"); var countitems=rembutts.length; // let's get cart amount rembutts.each(function(el, i){ el.addEvent('click', function(e) { e.stop(); //cart contains a single line if(countitems==1) { var cartable=$("cartable"), cartinfo=$("cartinfo"), boxcontainer=$("boxcontainer"); var trid= 'itemrow'+el.id.substr(6); boxsize=boxcontainer.getSize(); var hidetable = new Fx.Morph(boxcontainer, { duration: 750, link: 'chain', onStart: function() { // let's hide table cartable.fade(0); }, onComplete: function() { cartable.empty(); } }); //Empty the log and show the spinning indicator. //var log = $('log_res').empty().addClass('ajax-loading'); $('frmdel0').set('send', { onComplete: function(response) { // let's hide the table -reduce box container and update the cartinfo hidetable.start({ height: [boxsize.y, 250] }).chain(function(){ cartinfo.fade(0); $("checkinfo").fade(0); cartinfo.set('html', 'Aucun produit dans votre Caddie. Vous pouvez ajouter un produit en parcourant les pages ailerons.'); cartinfo.fade(1); }); } }); //Send the form. $('frmdel0').send(); } // multiple lines case else { // setting vars var subtotal=$("subtotal"), total=$("total"), ship=$("ship"), itemtot = $$(".item rowtotal") var subtotalhtml=subtotal.getProperty('html'); var shiphtml=ship.getProperty('html'); var totalhtml=total.getProperty('html'); // let's locate the right tr line... var trid= 'itemrow'+el.id.substr(6); var trvalue= 'itemtot'+el.id.substr(6); var itemamount=$(trvalue).getProperty('html').substr(13).toInt(); var subtotalupdate = (subtotalhtml.substr(13)-itemamount); //console.log(subtotalhtml+' ' +subtotalupdate); var totalupdate = (totalhtml.substr(13)-itemamount); var deletetr=$(trid); var deleteform='frmdel'+el.id.substr(6) // let's prepare the hightlights fx var highlightTotal = new Fx.Morph(total, { duration: 500, link: 'cancel', transition: 'quad:out' }); var highlightSubTotal = new Fx.Morph(subtotal, { duration: 500, link: 'cancel', transition: 'quad:out' }); // let's reduce its height to 0 while fading it var inCell= new Element('td', { 'id' :'emptycart', 'class' : 'head', 'colspan' : '4', 'text' : 'Your Cart is Empty', 'styles' : { 'text-align' : 'center' } }); var reducerow = new Fx.Morph(deletetr, { duration: 750, link: 'chain', onComplete: function() { highlightTotal.start({ backgroundColor: ['#fff36f', '#fff'], opacity: [1, 0] }); highlightSubTotal.start({ backgroundColor: ['#fff36f', '#fff'], opacity: [1, 0] }); subtotal.setProperty('html', ''); total.setProperty('html', ''); }, onChainComplete : function() { // let's empty the row from cells and inject a empty cart row deletetr.empty(); inCell.inject(deletetr, 'top'); subtotal.setProperty('html', ' € '+subtotalupdate); total.setProperty('html', ' € '+totalupdate); highlightSubTotal.start({ backgroundColor: ['#fff36f', '#fff'], opacity: [0, 1] }); highlightTotal.start({ backgroundColor: ['#fff36f', '#fff'], opacity: [0, 1] }); } }); /* reducerow.start({ opacity: [0, 1] }); */ // submit the form via ajax $(deleteform).set('send', { onComplete: function(response) { // let's hide the table -reduce box container and update the cartinfo reducerow.start({ opacity: [1, 0], display: ['block', 'none'] }) ; } }); //Send the form. $(deleteform).send(); // return the right params to update the cart } // end else multiple cart lines }); }, this); } }; window.addEvent('domready', function() { Shop.start(); }); function dynSelect(id1, id2, id3) { // based on bobby van der luis unobtrusive dynamic select boxes // http://www.bobbyvanderluis.com // Browser and feature tests to see if there is enough W3C DOM support var agt = navigator.userAgent.toLowerCase(); var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); var is_mac = (agt.indexOf("mac") != -1); if (!(is_ie && is_mac) && document.getElementById && document.getElementsByTagName) { // Obtain references to select boxes var sel1 = document.getElementById(id1); var sel2 = document.getElementById(id2); var sel3 = document.getElementById(id3); // Clone the dynamic select box var clone2 = sel2.cloneNode(true); // Obtain references to all cloned options var cloned2Options = clone2.getElementsByTagName("option"); var clone3 = sel3.cloneNode(true); var cloned3Options = clone3.getElementsByTagName("option"); // Onload init: call a generic function to display the related options in the dynamic select box refreshdynSelectOptions(sel1, sel2, sel3, cloned2Options, cloned3Options, "init"); // Onchange of the main select box: call a generic function to display the related options in the dynamic select box sel1.onchange = function() { refreshdynSelectOptions(sel1, sel2, sel3, cloned2Options, cloned3Options, "sel1"); }; } } function refreshdynSelectOptions(sel1, sel2, sel3, clonedOptions, cloned3Options, action) { var expeuro = $('zoneuro'); var expworld = $('zoneworld'); //console.log(sel2.options); while (sel2.options.length) { sel2.remove(0); } while (sel3.options.length) { sel3.remove(0); } var listeuroo = new Array('DE','AT','BE','ES','FI','FR','GR','IE','IT','LU','NL','PT','HU','PL','CY','CZ','DK','LV','GB','LT','SK','EE','SI','MT','SE','MC'); var pattern1 = /( |^)(select)( |$)/; // Iterate through all cloned options if(action=="init" || sel1.options[sel1.selectedIndex].value==0 ) { expeuro.setStyles({'display' : 'none', 'opacity': 0}); expworld.setStyles({'display' : 'none', 'opacity': 0}); for (var i = 0; i < clonedOptions.length; i++) { if (clonedOptions[i].className.match(pattern1) ) { sel2.appendChild(clonedOptions[i].cloneNode(true)); } } for (var j = 0; j < cloned3Options.length; j++) { if (cloned3Options[j].className.match(pattern1)) { sel3.appendChild(cloned3Options[j].cloneNode(true)); } } } else { if (new RegExp('^(' + listeuroo.join('|') + ')$').test(sel1.options[sel1.selectedIndex].value)) { expworld.setStyles({'display' : 'none', 'opacity': 0}); expeuro.setStyles({'display' : 'block', 'opacity': 1}); for (var i = 0; i < clonedOptions.length; i++) { if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match('euro')) { sel2.appendChild(clonedOptions[i].cloneNode(true)); } } for (var j = 0; j < cloned3Options.length; j++) { if (cloned3Options[j].className.match(pattern1) || cloned3Options[j].className.match('euro')) { sel3.appendChild(cloned3Options[j].cloneNode(true)); } } } else { expeuro.setStyles({'display' : 'none', 'opacity': 0}); expworld.setStyles({'display' : 'block', 'opacity': 1}); for (var i = 0; i < clonedOptions.length; i++) { if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match('world')) { sel2.appendChild(clonedOptions[i].cloneNode(true)); } } for (var j = 0; j < cloned3Options.length; j++) { if (cloned3Options[j].className.match(pattern1) || cloned3Options[j].className.match('world')) { sel3.appendChild(cloned3Options[j].cloneNode(true)); } } } } } var Perfoom = new Class({ Implements: [Options, Events], options: { url: null, leftMargin: 0, barMargin: 2, barWidth: 150, delay:500, start: 0 }, initialize: function(options) { this.setOptions(options); $$('.performer').each(function(el) { el.wrapper = el.getElement('.wrapper'); el.wrapper.removeClass('loading'); el.fill = el.getElement('.perfFill'); el.widthFx = new Fx.Tween(el.fill, {property:'width', duration: 'short'}); this.fillBar(this.options.start, el); }.bind(this)); this.animate.delay(this.options.delay, this); }, animate: function() { $$('.performer').each(function(el) { el.id = el.getAttribute('id'); el.wrapper = el.getElement('.wrapper'); el.offset = el.getPosition().x; el.fill = el.getElement('.perfFill'); el.percentid = el.fill.getAttribute('id'); el.percent = el.percentid.substr(1).toInt(); el.widthFx = new Fx.Tween(el.fill, {property:'width', duration: 'long'}); this.fillBar(el.percent, el); }.bind(this)); }, fillBar: function(percent, el) { el.newFill = (percent/100)*((this.options.barWidth+this.options.barMargin)) + this.options.leftMargin; el.widthFx.start(el.newFill); } }); var sQuick = new Class({ Implements: [Options], options: { id: null, height: 1, width: 1, container: null, messenger:null, properties: {}, params: { autostart: 'false' } }, toElement: function(){ return this.object; }, initialize: function(path, options){ var detector = getQueryParamValue('detectqt'); var container = $(options.container); if(isQTInstalled() || detector=='false') { this.instance = 'sQuick' + $time(); this.setOptions(options); options = this.options; var id = this.id = options.id || this.instance; var params = options.params, vars = options.vars; var properties = $extend({height: options.height, width: options.width}, options.properties); var self = this; if (Browser.Engine.trident || Browser.Engine.webkit){ properties.classid = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; //params.movie = path; } else { properties.type = 'video/quicktime'; properties.data = path; } var build = ''; } build += ''; this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild; } else { this.setOptions(options); options = this.options; var messenger = $(options.messenger); messenger.set('html', 'Quicktime not available'); } }, replaces: function(element){ element = $(element, true); element.parentNode.replaceChild(this.toElement(), element); return this; }, inject: function(element){ $(element, true).appendChild(this.toElement()); return this; } }); function isQTInstalled (element) { var qtInstalled = false; qtObj = false; if (navigator.plugins && navigator.plugins.length) { for (var i=0; i < navigator.plugins.length; i++ ) { var plugin = navigator.plugins[i]; if (plugin.name.indexOf("QuickTime") > -1) { qtInstalled = true; } } } else { execScript('on error resume next: qtObj = IsObject(CreateObject("QuickTimeCheckObject.QuickTimeCheck.1"))','VBScript'); qtInstalled = qtObj; } return qtInstalled; } function getQueryParamValue (param) { var q = document.location.search; var detectIndex = q.indexOf(param); var endIndex = (q.indexOf("&", detectIndex) != -1) ? q.indexOf("&", detectIndex) : q.length; if(q.length > 1 && detectIndex != -1) { return q.substring(q.indexOf("=", detectIndex)+1, endIndex); } else { return ""; } }