(function(d){var c=function(){var f=function(){this.loading=d("#loading");this.widgets=d("#widgets");this.fullText=d("#text").find("div.text").eq(0);this.sideNotes=this.fullText.find("ul.sidenotes");this.fullIcon=this.fullText.find("div.textIcon");this.textIcon=this.fullIcon.add(d("#annexe").find("div.text").eq(0).find("div.textIcon"))};return{init:f}}(),a={textSize:["largest","large","medium"],currentSize:"medium",buttons:document.createDocumentFragment(),buttonCreate:function(h,g){var f=document.createElement("a");f.id=h;f.href=document.location;f.title=translations.strWidget[g];if(h.indexOf(this.currentSize)!=-1){f.className="current"}this.buttons.appendChild(f)},init:function(){this.buttonCreate("wPrint","print");if(c.widgets.hasClass("withTextSize")){for(var g in this.textSize){this.buttonCreate("wTextSize-"+this.textSize[g],this.textSize[g])}}c.widgets.append(this.buttons);c.widgets.delegate("a[id^=wTextSize]","click",function(i){var h=this.id.replace("wTextSize-","");i.preventDefault();d(this).blur().addClass("current").siblings().removeClass("current");c.fullText.removeClass(a.currentSize).addClass(h);a.currentSize=h});c.widgets.delegate("#wPrint","click",function(h){window.print();return false});var f=d("div.wResizable");f.addClass(a.currentSize);d("a#wTextSize-"+a.currentSize).addClass("current")}},b={fancyNav:document.createElement("div"),habillage:false,init:function(){var f=this,g=parseInt(c.fullText.width(),10);this.habillage=c.fullText.hasClass("habillage");c.textIcon.each(function(i){var k=d(this),j=k.find("div.textIconWrap"),l=k.find("img")[0],h=i<c.fullIcon.length;if(f.habillage&&h){k.addClass("fancy");if(l.width/l.height<1.2){k.addClass("portrait");j.width(g)}else{k.addClass("landscape");j.width((l.width>g)?g:l.width)}}k.find("div.textIconAccess").delegate("a","click",function(m){m.preventDefault();this.blur();if(this.className=="iconOrig"){window.open(this.href)}else{d(l).closest("a").trigger("click")}});k.data("meta",f.getMeta(k));if(c.textIcon.length>1){f.fancyNavAppend(i)}f.attachFancybox(k)});if(f.habillage){c.fullText.delegate("div.textIcon","mouseenter",function(){d(this).addClass("over")}).delegate("div.textIcon","mouseleave",function(){d(this).removeClass("over")})}if(c.loading.is(":visible")){c.loading.fadeOut(1000)}},getMeta:function(f){return{title:f.find("p.titreillustration").clone(),caption:f.find("p.legendeillustration").clone(),credits:f.find("p.crditsillustration, p.creditillustration").clone(),origLink:f.find("div.textIconAccess").clone(true)}},fancyNavAppend:function(g){var f=document.createElement("a"),h=document.createDocumentFragment();f.href="#";f.innerHTML=g+1;f.onclick=function(){d.fancybox.pos(g);return false};h.appendChild(f);h.appendChild(document.createTextNode(" "));this.fancyNav.id="fancybox-nav";this.fancyNav.appendChild(h)},attachFancybox:function(g){var f=this;g.find("a[rel=iconSet]").eq(0).fancybox({autoScale:false,speedIn:300,speedOut:300,changeFade:"fast",changeSpeed:300,transitionOut:"none",transitionIn:"none",overlayColor:"#000",overlayOpacity:0.6,titlePosition:"inside",titleFormat:function(m,l,h,i){var k=d("<div/>"),j=g.data("meta");if(j.origLink){k.append(j.origLink)}if(j.title){k.append(j.title)}if(j.caption){k.append(j.caption)}if(j.credits){k.append(j.credits)}d("a",f.fancyNav).removeClass("current").eq(h).addClass("current");k.addClass("fancy").append(f.fancyNav);return k},onStart:function(j,h,i){g.removeClass("over")}})}};function e(){var g=c.sideNotes.length-1,f=0;c.sideNotes.each(function(j){var i=d(this),m=i.offset().top,l=f-m,h,k;f=m+i.height();if(l>0){i.css("top",l+"px");f+=l}if(j==g){h=c.fullText.offset().top+c.fullText.height();k=f-h;if(k>0){c.fullText.css("padding-bottom",k+"px")}}})}d(function(){c.init();a.init();if(c.fullText.length){if(c.sideNotes.length){e()}if(c.textIcon.length){var f=d("#shortcuts").find("a[href=#quotation]");f.clone().html(translations.strArticle.illustrations).attr("href","#illustrations").insertBefore(f).after("&nbsp;| ");b.init()}}})})(jQuery);