

/* -- quatuor.js */
N("Quatuor");if(!Array.prototype.indexOf)Array.prototype.indexOf=function(b,c){for(var a=c||0,d=this.length;a<d;a++)if(this[a]==b)return a;return-1};
(function(b){(function(){var c=function(a){a.preventDefault();a=b(this).closest("nav.switch").data("switch");a.as.removeClass("current").filter(this).addClass("current").end();a.rels.hide("fast").filter("#"+this.rel).show("fast").end()};b("nav.switch").each(function(a,d){var f=b(d),e=b(),g=f.find("a").each(function(b,d){e=e.add("#"+d.rel)}).click(c);f.data("switch",{rels:e,as:g})})})();(function(){var c=b(),a=null,d=b("header .menu nav").offset(),f=function(){a&&clearTimeout(a);a=setTimeout(function(){c.hide()},
125)};b("header .menu nav a").mouseenter(function(){a&&clearTimeout(a);c.hide().filter("#menu_"+this.rel).css({left:d.left+"px"}).show().end()}).mouseleave(f).each(function(b,d){d.rel.length&&(c=c.add("#menu_"+d.rel))});b("header nav.sub").mouseenter(function(){a&&clearTimeout(a)}).mouseleave(f)})();(function(){var c=null,a=b("#cart_details"),d=function(){a.hide();c=null};b("header .cart, #cart_details").mouseenter(function(){c&&clearTimeout(c);a.show()}).mouseleave(function(){c&&clearTimeout(c);
c=setTimeout(d,125)})})();(function(){var c=b(".list_container section");b(".list_container .section_overlay").css({width:c.width(),height:c.height()}).hide()})();(function(){b('a[rel~="toggle"]').click(function(d){d.preventDefault();var a=b(this),d=b(this.href.toString().replace(/.*#/,"#")),f=a.attr("rel").split(" "),c={},e=!1,a=a.offset();if(f.indexOf("fixleft")>=0)e=f.indexOf("offsetleft"),e=e>=0?parseInt(f[e+1],10)+a.left:a.left,c.left=e+"px",e=!0;if(f.indexOf("fixtop")>=0)e=f.indexOf("offsettop"),
e=e>=0?parseInt(f[e+1],10)+a.top:a.top,c.top=e+"px",e=!0;e&&d.css(c);d.toggle()});var c=function(b){b.preventDefault();b=document.location.pathname;document.location.href=b=="/"?"/fr-"+this.rel+"/":b.replace(/^\/[a-z]{2,2}-[a-z]{2,2}\/?/,"/fr-"+this.rel+"/")};b("a[rel=select_country]").click(function(d){d.preventDefault();var a=b("#country_list");if(a.is(":visible"))a.hide();else{var d=b(this).closest(".col"),f=d.offset(),e=d.width();b.getJSON("/quatuor/countries.json?isolang="+Epoc.isolang,function(b){a.find("li").remove();
var d=a.find("ul"),i;for(i in b)d.append('<li><a href="#" rel="'+i.toLowerCase()+'"><img src="/img/flags/'+i.toLowerCase()+'.png">'+b[i]+"</a></li>");a.show();a.css({top:f.top+24+"px",left:f.left+e-a.width()+"px"});a.find("a").click(c)})}});var a=null,d=0,f=-1,e=b("#dynamic_search_results"),g=b("#search").focus(function(){var d=b(this),a=d.offset(),d=d.width();e.css({top:a.top+30+"px",left:a.left-100+"px",width:d+105+"px"}).find("li").remove()}).blur(function(){setTimeout(function(){e.hide()},250)}).keydown(function(c){a&&
clearTimeout(a);switch(c.keyCode){case 40:f<d-1&&f++;e.find("a").removeClass("current").eq(f).addClass("current");c.preventDefault();return;case 38:f>0&&f--;e.find("a").removeClass("current").eq(f).addClass("current");c.preventDefault();return;case 27:f=-1;e.find("a").removeClass("current");c.preventDefault();return;case 13:if(f>=0){document.location=e.find("a")[f].href;c.preventDefault();return}}a=setTimeout(function(){a=null;b.getJSON("/search/?default_operator=AND&size=5&fields=title,pic.id.$id,path,supplier&q="+
encodeURIComponent(g.val()),function(a){var c="";d=a.hits.hits.length+1;f=-1;b(a.hits.hits).each(function(){c+='<li><a href="/'+Epoc.isolang+"/fiche."+this.fields.path+'/"><img src="/pt/d:list/'+this.fields.path+"."+this.fields["pic.id.$id"]+'.jpg"><span>'+this.fields.title+"</span><small>"+this.fields.supplier+"</small></a></li>"});c+='<li><a href="/'+Epoc.isolang+"/recherche?q="+encodeURIComponent(g.val())+'" class="last">Voir tous les r\u00e9sultats</a></li>';e.show().children().html(c)})},125)}),
h=b(".switch_tab#description");h.length&&h.children("div").height()>328&&h.children("a.button").show().click(function(d){d.preventDefault();h.css({height:"auto"});b(this).hide()})})();(function(){$orders=b(".order");b(".order header").click(function(){$orders.find("article,footer").hide();b(this).parent().find("article,footer").show()})})();(function(){var c=null,a={hover:function(d){d.preventDefault();c&&clearTimeout(c);c=null;this.tagName=="DIV"&&b(this).addClass("hover")},out:function(d){d.preventDefault();
c&&clearTimeout(c);var a=this;c=setTimeout(function(){c=null;a.tagName=="UL"?(b("#"+a.id.substr(0,a.id.length-5)).removeClass("hover"),b(a).hide()):(b(a).removeClass("hover"),b("#"+a.id+"_drop").hide())},125)},click:function(a){a.preventDefault();var a=b(this),c=a.offset(),e=26;a.hasClass("small")&&(e=20);b("#"+this.id+"_drop").css({left:c.left+"px",top:c.top+e+"px"}).show()},itemClick:function(a){a.preventDefault();var c=b(this),a=c.closest("ul"),e=b("#"+a.get(0).id.substr(0,a.get(0).id.length-5));
a.hide();e.removeClass("hover");var g=e.find("input"),h=g.val(),a=b.Event("change");a.val=c.attr("rel");a.label=c.html();g.val(a.val);e.trigger(a);a.isDefaultPrevented()?g.val(h):e.find("span").html(a.label)}};b.fn.dropInit=function(){this.mouseenter(a.hover).mouseleave(a.out).click(a.click).each(function(){var c=b(this).find("ul");c.attr("id",this.id+"_drop").hide().addClass("drop").appendTo(document.body).mouseenter(a.hover).mouseleave(a.out);c.find("a").click(a.itemClick)});return this};b.fn.dropClear=
function(){this.unbind().each(function(a,c){b("#"+c.id+"_drop").unbind().hide().appendTo(c).find("a").unbind()});return this};b(function(){b(".drop").dropInit()})})()})(jQuery);

