
var Skin;var SkinManager=new Class({skins:new Array(),active:-1,initialize:function(){$('page').setStyles({'z-index':1000,'position':'relative'});},register:function(object){var f=-1;this.skins.each(function(skin,idx){if(skin.background==object.background&&skin.color==object.color){f=idx;}});if(f>=0){return f;}
if(!$type(object.background)&&!$type(object.color))
return-1;var id=this.skins.length;this.skins.push(object);var clone=new Element('div',{'id':'skin-'+id}).setStyles($(document.body).getCoordinates()).setStyles({'position':'absolute','background-position':'50% 0px','background-repeat':'no-repeat','z-index':id+1,'visibility':'hidden'});clone.inject($(document.body));if(object.background)
clone.setStyle('background-image',(object.background=='none'?'none':'url('+object.background+')'));if(object.color)
clone.setStyle('background-color',object.color);clone.fx=new Fx.Style(clone,'opacity',{duration:300,transition:Fx.Transitions.linear,fps:50});this.skins[id].skin=clone;$(window).addEvent('resize',function(){clone.setStyles($(document.body).getCoordinates())});return id;},set:function(object){id=this.register(object);if(id==-1)
return;if(this.active==-1){$('skin-'+id).setStyle('opacity',1);this.active=id;return;}
old=this.active;this.skins.each(function(s,i){var c=this.skins.length;s.skin.setStyles((i==old?{'z-index':c}:(i==id?{'z-index':c-1}:{'z-index':0,'opacity':0})));},this);$('skin-'+old).fx.start(1,0);$('skin-'+id).fx.start(0,1);this.active=id;return;}});var Basket;var BasketManager=new Class({options:{onProductAdd:Class.empty,onProductRemove:Class.empty,onEmpty:Class.empty},initialize:function(options){this.setOptions(options);},add:function(product,qty){new Ajax('/panier.nt.html',{method:'get',data:{'op':'prodmod','prod':product,'qte':qty||1},onComplete:function(response){this.fireEvent('onProductAdd',[response]);}.bind(this)}).request();},remove:function(product,qty){new Ajax('/panier.nt.html',{method:'get',data:{'op':'prodmod','prod':product,'qte':-1*(qty||1)},onComplete:function(response){this.fireEvent('onProductRemove',[response]);}.bind(this)}).request();},empty:function(){new Ajax('/panier.nt.html',{method:'get',data:{'op':'empty'},onComplete:function(response){this.fireEvent('onEmpty',[response]);}.bind(this)}).request();}});BasketManager.implement(new Options,new Events);Element.extend({toggle:function(){this.setStyle('display',this.getStyle('display')=='none'?'':'none');}});window.ie8=function(){return $type(document.querySelectorAll)=='object'}();window.addEvent('domready',function(){if(window.client.ie)
{switch(window.client.ie)
{case"6.0":$(document.body).addClass('ie-6');break;case"7.0":$(document.body).addClass('ie-7');break;case"8.0":$(document.body).addClass('ie-8');break;case"9.0":$(document.body).addClass('ie-9');break;}}
else if(window.gecko)$(document.body).addClass('gecko');else if(window.opera)$(document.body).addClass('presto');else if(window.webkit)$(document.body).addClass('webkit');if(navigator.userAgent.match(/Linux/i))
$(document.body).addClass('linux');else if(navigator.userAgent.match(/Mac OS/i))
$(document.body).addClass('mac-os');Skin=new SkinManager();Basket=new BasketManager();$$('input[type=hidden]').each(function(o){o.setProperty('autocomplete','off');});var aPanel=$E('#account .panel');if(!window.ie6){$$('#account .panel input').each(function(o){o.addEvents({'blur':function(){aPanel.setStyle('display','');},'focus':function(){aPanel.setStyle('display','block');}});});}
else{$('account').addEvent('mouseover',function(){$$('#account .panel').setStyle('display','block');});$('account').addEvent('mouseout',function(){$$('#account .panel').setStyle('display','none');});}
$$('#prod li.facebook a').each(function(l){l.addEvent('click',function(e){new Event(e).stop();var fb=window.open(l.href,'facebook','menubar=no,status=no,toolbar=no,width=584,height=429');fb.focus();})});if(typeof(is_custom_theme)!='undefined'){if(!isHomePage()&&is_custom_theme){$E('#page').addEvent('click',function(e){var tg=e.target?e.target:e.srcElement;if(tg.parentNode.tagName=='BODY'){window.location=custom_theme_url;}});}}
$$('.formulaire_recherche').addEvent('submit',function(event)
{new Event(event).preventDefault();var champ_select_recherche=null;var champ_texte_recherche=this.getElement('input[type="text"]');if(this.getElement('select'))
{champ_select_recherche=this.getElement('select');}
var mots_cles=champ_texte_recherche.value.trim();if(mots_cles!='')
{url_recherche=formaterUrlRecherche(mots_cles);if(champ_select_recherche==null||champ_select_recherche.value=='')
{window.location.href='/achat/'+url_recherche+'/';}
else
{window.location.href='/achat/'+champ_select_recherche.value.toLowerCase()+'/'+url_recherche+'/';}}
else
{window.location.href='/achat/';}});$$('.asset-link').each(function(link,index)
{var link_id=$(link).getProperty('id');if(link_id&&link_id.indexOf('-')!=-1)
{var asset_id=link_id.substring(link_id.indexOf('-')+1);$(link).setProperty('href','/assets/'+asset_id);}});});function formaterUrlRecherche(str)
{str=str.toLowerCase().trim();str=str.replace(/\u20AC/g,String.fromCharCode(128));str=str.replace(/\+/g,'%2B');str=str.replace(/\//g,'%2F');str=str.replace(/(-)+/g,' ');str=str.replace(/(\s)+/g,'-');str=escape(str);return str;}
function isHomePage()
{var location=document.location.href;var tempArray=location.split('/');var dernier_element=tempArray[tempArray.length-1];if((tempArray.length==4)&&(dernier_element=='index.php'||dernier_element==''))
{return true;}
return false;}
