
var BlockSlider=new Class({initialize:function(el){var _this=this;this.modeVertical=el.getParent().hasClass('vertical')?true:false;this.tabsMode=el.getParent().hasClass('tabsMode')?true:false;this.lisTabs=[];if(this.modeVertical){this.opt={sizeEl:'height',offsetSizeEl:'offsetHeight',scrollSizeEl:'scrollHeight',marginEl:'auto 0',before:'top',after:'bottom',scrollDiff:'scrollTop'}}else{this.opt={sizeEl:'width',offsetSizeEl:'offsetWidth',scrollSizeEl:'scrollWidth',marginEl:'0 auto',before:'left',after:'right',scrollDiff:'scrollLeft'}}
this.el=$(el);this.lis=this.el.getElements("li.cell");this.ctn=new Element("div",{"tabindex":"0"}).setStyles({"overflow":"hidden","position":"relative","margin":this.opt.marginEl});if(this.modeVertical){this.ctn.style[this.opt.sizeEl]=this.lis[0][this.opt.offsetSizeEl]*3+'px';}else{if(this.tabsMode){this.ctn.style[this.opt.sizeEl]=this.el[this.opt.offsetSizeEl]+'px';}else{this.ctn.style[this.opt.sizeEl]=this.el[this.opt.offsetSizeEl]+4+'px';}}
this.ctn.inject(this.el,"before");this.el.inject(this.ctn);this.ctn.addEvent("mousewheel",function(e){e=new Event(e)
e.stop();this.move(e.wheel);}.bind(this))
this.ctn.addEvent("click",function(e){e=new Event(e)
e.target.focus();}.bind(this));this.ctn.addEvent("keydown",function(e){e=new Event(e)
if(e.key==this.opt.before)this.move(-1)
else if(e.key==this.opt.right)this.move(1)}.bind(this));if(this.tabsMode){this[this.opt.sizeEl]=this.ctn[this.opt.offsetSizeEl];}else{this[this.opt.sizeEl]=(this.ctn[this.opt.offsetSizeEl])/3;}
this.currentIndex=0;this.ctn[this.opt.scrollDiff]=0;this.futurValue=this.ctn[this.opt.scrollDiff];this.el.setStyle(this.opt.sizeEl,this[this.opt.sizeEl]*this.lis.length);this.lis.setStyle(this.opt.sizeEl,this[this.opt.sizeEl]);if(this.tabsMode){var _nb=this.lis.length;var _blockInside=getParent(this.el,{className:'blockInside'});var _ul=new Element('ul',{'class':'paginationTabsMode'});for(var i=0;i<_nb;i++){var _a=new Element('a',{'href':'#'+i+1}).setText(i+1);_a.index=i;_a.addEvent("click",function(e){e=new Event(e)
new Event(e).stop();_this.move(this.index);})
var _li=new Element('li').adopt(_a);this.currentTabIndex=0;_ul.adopt(_li);this.lisTabs.push(_li);};$(_blockInside).adopt(new Element('div',{'class':'foot'}).adopt(_ul));}else{this.prev=new Element("span",{tabindex:0,"class":"sliderPrev inactive"}).injectBefore(this.ctn);this.prev.addEvent("click",function(e){e=new Event(e)
new Event(e).stop();this.move(-1)}.bind(this))
this.prev.addEvent("keydown",function(e){e=new Event(e)
if(e.key=="enter"){new Event(e).stop();this.move(-1)}}.bind(this));this.next=new Element("span",{tabindex:0,"class":"sliderNext"}).injectBefore(this.ctn);this.next.addEvent("click",function(e){e=new Event(e)
e.stop();this.move(1)}.bind(this))
this.next.addEvent("keydown",function(e){e=new Event(e)
if(e.key=="enter"){new Event(e).stop();this.move(1)}}.bind(this));}
this.check();},move:function(direction){if(this.tabsMode){this.futurValue=this[this.opt.sizeEl]*direction;this.currentIndex=direction;}else{this.futurValue+=(this[this.opt.sizeEl]*direction)*3;}
if(this.modeVertical){this.anim=new Fx.Scroll(this.ctn,{onComplete:function(){this.check();}.bind(this)}).scrollTo(0,this.futurValue);}else{this.anim=new Fx.Scroll(this.ctn,{onComplete:function(){this.check();}.bind(this)}).scrollTo(this.futurValue,0);}},check:function(){if(this.tabsMode){this.lisTabs.each(function(liTab){$(liTab).removeClass('current');})
$(this.lisTabs[this.currentIndex]).addClass('current');}
if(this.prev)this.prev.removeClass("inactive");if(this.next)this.next.removeClass("inactive");if(this.futurValue>=(this.ctn[this.opt.scrollSizeEl]-this.ctn[this.opt.offsetSizeEl])){this.futurValue=this.ctn[this.opt.scrollSizeEl]-this.ctn[this.opt.offsetSizeEl];if(this.next)this.next.addClass("inactive");}
else if(this.futurValue<=0){this.futurValue=0;if(this.prev)this.prev.addClass("inactive");}
this.currentIndex=(this.futurValue/this[this.opt.sizeEl]).toInt();}});var PopIn=new Class({options:{width:650},initialize:function(options){this.setOptions(options);this.page=$E('body');this.layer=$('layer');if(!(this.page&&this.layer)){return;}
this.createElms();this.sendTo();this.doUrl();},doUrl:function(){var qString=document.location.search;var toUse=qString.substr(1,qString.length);var duos=toUse.split('&');var number=0;var param=false;var sendToAlreadyOpened=false;duos.each(function(duo){var array=duo.split('=');if(array[0]=='selectedAxs'){param=true;identifiant=array[1];}
if(array[0]=='sendToOpen'){sendToAlreadyOpened=array[1];}});var identifiant=$(identifiant);if(!identifiant)return;this.show(identifiant,sendToAlreadyOpened);update_form_query_string();},createElms:function(){this.page.adopt(this.layer);this.mask=new Element('div',{'class':'popMask'}).setOpacity(0);this.page.adopt(this.mask);if(IS_IE){this.mask.iframe=new Element('iframe')
this.mask.iframe.src='javascript:void(0)';this.mask.adopt(this.mask.iframe);}},setMaskDimensions:function(){var coord={};coord.width=window.getScrollWidth();coord.height=window.getScrollHeight();this.mask.setStyles(coord);if(IS_IE){this.mask.iframe.setStyles(coord)};},updateLayerPosition:function(options){this.posX=window.getScrollLeft()+window.getWidth()/2-this.options.width/2;this.posY=window.getScrollTop()+window.getHeight()/2-this.layer.getSize().size.y/2;this.layer.setStyles({'left':this.posX,'top':this.posY,'width':this.options.width});},populate:function(ref){this.contenuLayer=$(ref).getElement('.detailsContent').clone();this.contenuLayer.setStyle('display','block');this.contenuLayer.injectBefore(this.switchSentToAFriendLink);},populateSelect:function(ref){if(this.contenuLayer&&this.contenuLayer.getParent()){this.contenuLayer.remove();}
this.contenuLayer=$(ref).getElement('.selectContent').clone();this.contenuLayer.setStyle('display','block');if(this.switchSentToAFriendLink){this.contenuLayer.injectBefore(this.switchSentToAFriendLink);}else{this.layer.adopt(this.contenuLayer);}},unPopulate:function(){this.contenuLayer.remove();},show:function(ref,bool){this.populate(ref);this.updateLayerPosition();this.setMaskDimensions();if(bool=='true')this.switchSendTo();this.layer.effect('opacity').start(1);this.mask.effect('opacity').start(0.7);},showSimple:function(ref){var _this=this;this.populateSelect(ref);this.updateLayerPosition();this.setMaskDimensions();this.layer.effect('opacity').start(1);this.mask.effect('opacity').start(0.7);this.layer.addClass('simplePopin');this.layer.getElements('.closeBox').each(function(oLink){oLink.addEvent('click',function(e){new Event(e).stop();_this.hide();})})},showSelect:function(ref){var _this=this;this.populateSelect(ref);this.updateLayerPosition();this.setMaskDimensions();this.offuscElms(ref);this.layer.effect('opacity').start(1);this.mask.effect('opacity').start(0.7);this.contenuLayer.getElements('.closeBox').each(function(oLink){oLink.addEvent('click',function(e){new Event(e).stop();_this.hide();})});},hide:function(){this.mask.effect('opacity',{duration:200,onStart:function(){if(this.switchSendTo.open==true)this.switchSendTo();}.bind(this),onComplete:function(){this.layer.effect('opacity').start(0);this.unPopulate();}.bind(this)}).start(0);},offuscElms:function(ref){this.layer.addClass('selectLayer');if(this.switchSentToAFriendLink)this.switchSentToAFriendLink.addClass('hidden');},zoom:function(img){var _self=this;var imgSrc=img.src
var imgUrl=imgSrc.split('/')[imgSrc.split('/').length-1];var zoomedUrl=_zoomedImagesPrefix+imgUrl;var zoomedUrl=imgSrc.replace(new RegExp("\\b"+imgUrl+"\\b","g"),zoomedUrl);this.secLayer=new Element('div');this.secLayer.className='cloneLayerInside';this.secLayer.innerHTML='<a class="closeBox" onclick="return false;" href="#">Fermer</a>';this.layer.adopt(_self.secLayer);this.secLayer.setStyles({'height':_self.contenuLayer.scrollHeight+30,'width':_self.contenuLayer.scrollWidth,'opacity':0})
this.secLayer.effect('opacity',{duration:300,onComplete:function(){new Asset.image(zoomedUrl,{onload:function(){var image=this;image.setOpacity(0);image.className+='zoomedImage';var heighToUse=window.ie6?_self.secLayer.offsetHeight:_self.secLayer.scrollHeight;image.setAttribute('height',heighToUse);_self.secLayer.adopt(this);image.style.width='auto';_self.secLayer.on=true;this.effect('opacity').start(1);}})}}).start(1)
this.secLayer.addEvent('click',function(e){new Event(e).stop();_self.closeZoom();});},closeZoom:function(){var _self=this;this.secLayer.effect('opacity',{onComplete:function(){_self.secLayer.remove();_self.secLayer.on=false;}}).start(0)},sendTo:function(){this.switchSentToAFriendLink=this.layer.getElement('.switchSentToAFriendLink');if(!this.switchSentToAFriendLink)return;this.liens=this.switchSentToAFriendLink.getElements('a');this.sendToAFriend=this.layer.getElement('.sendToAFriend');this.sendToAFriendContent=this.sendToAFriend.getElement('.sendContent');this.sendToAFriend.sizeY=this.sendToAFriend.getSize().size.y;this.sendToAFriendContent.setStyle('margin-top',-this.sendToAFriend.sizeY);},switchSendTo:function(){if(this.switchSendTo.open==true){this.sendToAFriendContent.effect('margin-top',{onComplete:function(){this.layer.effect('top').start(this.posY);this.liens[1].addClass('hidden');this.liens[0].removeClass('hidden');}.bind(this)}).start(-this.sendToAFriend.sizeY);this.switchSendTo.open=false;}else{this.layer.effect('top',{onComplete:function(){this.sendToAFriendContent.effect('margin-top').start(0);this.liens[0].addClass('hidden');this.liens[1].removeClass('hidden');}.bind(this)}).start(this.posY-this.sendToAFriend.sizeY/2);this.switchSendTo.open=true;}}});PopIn.implement(new Options)
var RangePage=new Class({initialize:function(rp){this.content=$(rp);var _this=this;this.setCufon();},setCufon:function(){var toCufon=this.content.getElements("h3").concat(this.content.getElements("h4"));Cufon.replace(toCufon);}});var InitDws={setCufon:function(){if($('submenu')){var menuChildren=$('submenu').getChildren();menuChildren.each(function(el){var spans=el.getElements("span");if(!localCyrillic.contains(cufonSiteLocal)){Cufon.replace(spans);}});}}}
window.addEvent("domready",function(){if($('scroller')){new BlockSlider($('scroller').getElement('ul'));}
new InitDws.setCufon();$$('.rangepage').each(function(rp){new RangePage(rp);})
popup=new PopIn();})
var ajax_url_preview;function call_url(url,params,after_trigger,onSuccess){if(params!=null){var url=url+'&'+to_query_string(params);}
new Ajax(url,{method:'get',onComplete:function(response){if(typeof after_trigger=='function')after_trigger(response);},onFailure:function(response){}}).request();}
function to_query_string(hashObject){var hash=$H(hashObject);var queryString=[];hash.each(function(value,name){var qs=function(val){queryString.push(name+'='+encodeURIComponent(val));};if($type(value)=='array')value.each(qs);else qs(value);});return queryString.join('&');}
function updateCartSelect(url){var _cartNbItems=$('cartNbItems');if(_cartNbItems){new Ajax(url,{method:"post",onComplete:function(response){$('cartNbItems').innerHTML=response;}}).request();}}
var menuVitafTimeout;window.addEvent('domready',function(){if($('menuVitaf')){Array.prototype.max=function(){return Math.max.apply({},this);}
$$('.menuN2').each(function($menuN2,i){new menuVITAF(i);});$$('#menuVitaf .entry').each(function($menuN1,i)
{$menuN1.addEvent('mouseleave',function()
{function doRemoveMenuState(){$menuN1.removeClass('hover');}
menuVitafTimeout=setTimeout(doRemoveMenuState,500);});$menuN1.addEvent('mouseenter',function()
{clearTimeout(menuVitafTimeout);$$('#menuVitaf .entry').each(function($entry){$entry.removeClass('hover');});$$('.menuN2Opened .contentPart').each(function($contentPart){$contentPart.removeAttribute('style');});$$('.menuN2Opened').each(function($menuN2Opened){$menuN2Opened.removeClass('menuN2Opened');});$menuN1.addClass('hover');});});}});var menuVITAF=new Class({properties:{nbEntriesMax:10,nbEntriesMaxExtended:0,nbColsMaxBySection:2,nbColsMax:4,navNumber:0,$nav:''},initialize:function(navNumber){this.properties.navNumber=navNumber;this.properties.$nav=$('menuN2_'+this.properties.navNumber);var that=this;var nb_sections=$$('#menuN2_'+this.properties.navNumber+' .section_list').length;var assigned_cols=0;var nb_entries_total=0;var hasMaxInSection;var nb_cols_by_section=new Array();var nb_cols_by_section_total=0;var $list=$ES('.section_list',this.properties.$nav);$list.each(function($section_list,i)
{var nb_entries=$ES('li',$section_list).length;var nb_cols=Math.ceil(nb_entries/that.properties.nbEntriesMax);if((nb_entries>(that.properties.nbColsMaxBySection*that.properties.nbEntriesMax))&&(i==0)&&($list.length>1))hasMaxInSection=true;nb_entries_total+=nb_entries;nb_cols_by_section.push(nb_cols);nb_cols_by_section_total=nb_cols+nb_cols_by_section_total;});var nb_cols_by_section_real=new Array();var nb_cols_by_section_used=0;nb_cols_by_section.each(function(nb_cols,i)
{var nb_cols_used=nb_cols;if(nb_cols<that.properties.nbColsMaxBySection){nb_cols_used=nb_cols;nb_cols_by_section_real.push(nb_cols_used);}
else if(nb_cols==that.properties.nbColsMaxBySection){nb_cols_used=nb_cols;nb_cols_by_section_real.push(nb_cols_used);}
else if((nb_cols>that.properties.nbColsMaxBySection)&&(nb_sections==1)){nb_cols_used=nb_cols;nb_cols_by_section_real.push(nb_cols_used);}
else if((nb_cols>that.properties.nbColsMaxBySection)&&((i+1)==nb_sections)){nb_cols_used=that.properties.nbColsMax-nb_cols_by_section_used;nb_cols_by_section_real.push(nb_cols_used);}
else{nb_cols_used=that.properties.nbColsMaxBySection;nb_cols_by_section_real.push(nb_cols_used);}
nb_cols_by_section_used=nb_cols_by_section_used+nb_cols_used;});$ES('.section_list',this.properties.$nav).each(function($section_list,i)
{var $section_list_cloned=$section_list.clone();var $section_reduced=$('section_list_'+that.properties.navNumber+'_'+i+'_reduced');var $section_extended=$('section_list_'+that.properties.navNumber+'_'+i+'_extended');var nb_cols=nb_cols_by_section_real[i];var nb_entries=$ES('li',$section_list).length;that.properties.nbEntriesMaxExtended=Math.round(nb_entries/nb_cols);for(var j=0;j<nb_cols;j++)
{var $col_section_list=$section_list;var $section=$section_reduced;var to=that.properties.nbEntriesMax;that.doBuildCol($col_section_list,$section,to);var $col_section_list=$section_list_cloned;var $section=$section_extended;var to=that.properties.nbEntriesMaxExtended;that.doBuildCol($col_section_list,$section,to);}
that.doRemoveLists($section_list);});if((nb_entries_total>(that.properties.nbEntriesMax*that.properties.nbColsMax))||hasMaxInSection){that.doBuildExtendButtons(navNumber);}
that.bindEvents();},getItems:function($section_list,from,to)
{var entries=new Array();$ES('li',$section_list).slice(from,to).each(function($entry,i){entries.push($entry);});return entries;},setSameHeightOnSections:function($nav)
{$nav.removeAttribute('style');$E('.contentPart',$nav).removeAttribute('style');$ES('.section',$nav).each(function($section){$section.removeAttribute('style');});$ES('.menuN2Inner',$nav).each(function($menuN2Inner){$menuN2Inner.removeAttribute('style');});var new_height=this.getMaxHeightOnSection($nav);$nav.style.height=new_height+'px';$E('.contentPart',$nav).style.height=new_height+'px';$E('.menuN2Inner',$nav).style.height=(new_height+14)+'px';$ES('.section',$nav).each(function($section){$section.style.height=new_height+'px';});},getMaxHeightOnSection:function($nav)
{var sizes=new Array();var max_height=0;$ES('.section',$nav).each(function(elm_section){var size=elm_section.getCoordinates();sizes.push(size.height);});max_height=sizes.max();return Math.round(max_height);},doBuildExtendButtons:function()
{var $wrapper=$('contentPart_btnToggle_'+this.properties.navNumber);var $lnk=new Element('a',{'href':'#','title':''});$wrapper.adopt($lnk);},doToggleNav:function($nav)
{clearTimeout(menuVitafTimeout);$nav.getParent().removeEvents();$nav.getParent().addClass('hover');var that=this;if($nav.hasClass('menuN2Opened'))
{function setMenuEvents()
{$nav.getParent().removeClass('hover');$nav.getParent().addEvent('mouseleave',function(){function doRemoveMenuState(){$nav.getParent().removeClass('hover');$nav.removeAttribute('style');$E('.menuN2Inner',$nav).removeAttribute('style');$E('.contentPart',$nav).removeAttribute('style');$ES('.section',$nav).each(function($section){$section.removeAttribute('style');});}
menuVitafTimeout=setTimeout(doRemoveMenuState,500);});$nav.getParent().addEvent('mouseenter',function()
{clearTimeout(menuVitafTimeout);$$('#menuVitaf .entry').each(function($entry){$entry.removeClass('hover');});$$('.menuN2Opened .contentPart').each(function($contentPart){$contentPart.removeAttribute('style');});$$('.menuN2Opened').each(function($menuN2Opened){$menuN2Opened.removeClass('menuN2Opened');});$nav.getParent().addClass('hover');that.setSameHeightOnSections($nav);});}
$nav.getParent().addEvent('mouseleave',function()
{menuVitafTimeout=setTimeout(setMenuEvents,2000);});}
else
{$nav.getParent().addEvent('mouseleave',function(){function doRemoveMenuState(){$nav.getParent().removeClass('hover');$nav.removeAttribute('style');$E('.menuN2Inner',$nav).removeAttribute('style');$E('.contentPart',$nav).removeAttribute('style');$ES('.section',$nav).each(function($section){$section.removeAttribute('style');});}
menuVitafTimeout=setTimeout(doRemoveMenuState,500);});$nav.getParent().addEvent('mouseenter',function()
{clearTimeout(menuVitafTimeout);$$('#menuVitaf .entry').each(function($entry){$entry.removeClass('hover');});$$('.menuN2Opened .contentPart').each(function($contentPart){$contentPart.removeAttribute('style');});$$('.menuN2Opened').each(function($menuN2Opened){$menuN2Opened.removeClass('menuN2Opened');});$nav.getParent().addClass('hover');that.setSameHeightOnSections($nav);});}
$nav.toggleClass('menuN2Opened');},doRemoveLists:function($section_list)
{$section_list.remove();},doBuildCol:function($section_list,$section,to)
{var from=0;var entries;var $col='';$col=new Element('ul',{'class':'col'});$section.adopt($col);entries=this.getItems($section_list,from,to);$col.adopt(entries);},bindEvents:function()
{var that=this;var $btn=$E('a','contentPart_btnToggle_'+this.properties.navNumber);if($btn){var addEvent=function(obj)
{var that=obj;var $nav=that.properties.$nav;$btn.addEvent('click',function(e)
{var e=new Event(e);e.stopPropagation();e.preventDefault();this.blur();that.doToggleNav($nav);that.setSameHeightOnSections($nav);});$btn.addEvent('mousedown',function()
{this.blur();});}(this);}},setGAtrackerEvents:function()
{var attr_class=this.properties.$nav.className.split(' ');var nav_label=attr_class[1];$navN1=this.properties.$nav.getPrevious();$navN1.addEvent('mouseover',function(e){e=new Event(e);sendTracker('Navigation-DWS','View',nav_label);});$navN1.addEvent('click',function(e){e=new Event(e);sendTracker('Navigation-DWS-'+nav_label,'Click','Nav');});$ES('a[rel!=""]',this.properties.$nav).addEvent('click',function(e){e=new Event(e);var label=this.getAttribute('rel');sendTracker('Navigation-DWS-'+nav_label,'Click',label);});}});
