// mootools-more
Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical"},initialize:function(F,D){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper);}},true);this.element=this.subject=$(F);this.parent(D);var E=this.element.retrieve("wrapper");this.wrapper=E||new Element("div",{styles:$extend(this.element.getStyles("margin","position"),{overflow:"hidden"})}).wraps(this.element);this.element.store("wrapper",this.wrapper).setStyle("margin",0);this.now=[];this.open=true;},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;},set:function(B){this.element.setStyle(this.margin,B[0]);this.wrapper.setStyle(this.layout,B[1]);return this;},compute:function(G,H,I){var J=[];var F=2;F.times(function(A){J[A]=Fx.compute(G[A],H[A],I);});return J;},start:function(N,K){if(!this.check(arguments.callee,N,K)){return this;}this[K||this.options.mode]();var L=this.element.getStyle(this.margin).toInt();var M=this.wrapper.getStyle(this.layout).toInt();var H=[[L,M],[0,this.offset]];var I=[[L,M],[-this.offset,0]];var J;switch(N){case"in":J=H;break;case"out":J=I;break;case"toggle":J=(this.wrapper["offset"+this.layout.capitalize()]==0)?H:I;}return this.parent(J[0],J[1]);},slideIn:function(B){return this.start("in",B);},slideOut:function(B){return this.start("out",B);},hide:function(B){this[B||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(B){this[B||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(B){return this.start("toggle",B);}});Element.Properties.slide={set:function(D){var C=this.retrieve("slide");if(C){C.cancel();}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},D));},get:function(B){if(B||!this.retrieve("slide")){if(B||!this.retrieve("slide:options")){this.set("slide",B);}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")));}return this.retrieve("slide");}};Element.implement({slide:function(H,G){H=H||"toggle";var J=this.get("slide"),F;switch(H){case"hide":J.hide(G);break;case"show":J.show(G);break;case"toggle":var I=this.retrieve("slide:flag",J.open);J[(I)?"slideOut":"slideIn"](G);this.store("slide:flag",!I);F=true;break;default:J.start(H,G);}if(!F){this.eliminate("slide:flag");}return this;}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(H,E){this.element=this.subject=$(H);this.parent(E);var F=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=$(this.element.getDocument().body);}var G=this.element;if(this.options.wheelStops){this.addEvent("start",function(){G.addEvent("mousewheel",F);},true);this.addEvent("complete",function(){G.removeEvent("mousewheel",F);},true);}},set:function(){var B=Array.flatten(arguments);this.element.scrollTo(B[0],B[1]);},compute:function(G,H,I){var J=[];var F=2;F.times(function(A){J.push(Fx.compute(G[A],H[A],I));});return J;},start:function(O,J){if(!this.check(arguments.callee,O,J)){return this;}var M=this.element.getSize(),L=this.element.getScrollSize();var P=this.element.getScroll(),N={x:O,y:J};for(var K in N){var I=L[K]-M[K];if($chk(N[K])){N[K]=($type(N[K])=="number")?N[K].limit(0,I):I;}else{N[K]=P[K];}N[K]+=this.options.offset[K];}return this.parent([P.x,P.y],[N.x,N.y]);},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);},toRight:function(){return this.start("right",false);},toBottom:function(){return this.start(false,"bottom");},toElement:function(D){var C=$(D).getPosition(this.element);return this.start(C.x,C.y);}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(D,C){this.elements=this.subject=$$(D);this.parent(C);},compute:function(P,O,N){var K={};for(var J in P){var M=P[J],R=O[J],Q=K[J]={};for(var L in M){Q[L]=this.parent(M[L],R[L],N);}}return K;},set:function(H){for(var G in H){var E=H[G];for(var F in E){this.render(this.elements[G],F,E[F],this.options.unit);}}return this;},start:function(K){if(!this.check(arguments.callee,K)){return this;}var O={},N={};for(var J in K){var Q=K[J],M=O[J]={},P=N[J]={};for(var L in Q){var R=this.prepare(this.elements[J],L,Q[L]);M[L]=R.from;P[L]=R.to;}}return this.parent(O,N);}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,modifiers:{x:"left",y:"top"}},initialize:function(){var D=Array.link(arguments,{options:Object.type,element:$defined});this.element=$(D.element);this.document=this.element.getDocument();this.setOptions(D.options||{});var C=$type(this.options.handle);this.handles=(C=="array"||C=="collection")?$$(this.options.handle):$(this.options.handle)||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);return this;},start:function(G){if(this.options.preventDefault){G.preventDefault();}this.fireEvent("beforeStart",this.element);this.mouse.start=G.page;var E=this.options.limit;this.limit={x:[],y:[]};for(var F in this.options.modifiers){if(!this.options.modifiers[F]){continue;}if(this.options.style){this.value.now[F]=this.element.getStyle(this.options.modifiers[F]).toInt();}else{this.value.now[F]=this.element[this.options.modifiers[F]];}if(this.options.invert){this.value.now[F]*=-1;}this.mouse.pos[F]=G.page[F]-this.value.now[F];if(E&&E[F]){for(var H=2;H--;H){if($chk(E[F][H])){this.limit[F][H]=$lambda(E[F][H])();}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop);},check:function(C){if(this.options.preventDefault){C.preventDefault();}var D=Math.round(Math.sqrt(Math.pow(C.page.x-this.mouse.start.x,2)+Math.pow(C.page.y-this.mouse.start.y,2)));if(D>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",this.element).fireEvent("snap",this.element);}},drag:function(C){if(this.options.preventDefault){C.preventDefault();}this.mouse.now=C.page;for(var D in this.options.modifiers){if(!this.options.modifiers[D]){continue;}this.value.now[D]=this.mouse.now[D]-this.mouse.pos[D];if(this.options.invert){this.value.now[D]*=-1;}if(this.options.limit&&this.limit[D]){if($chk(this.limit[D][1])&&(this.value.now[D]>this.limit[D][1])){this.value.now[D]=this.limit[D][1];}else{if($chk(this.limit[D][0])&&(this.value.now[D]<this.limit[D][0])){this.value.now[D]=this.limit[D][0];}}}if(this.options.grid[D]){this.value.now[D]-=(this.value.now[D]%this.options.grid[D]);}if(this.options.style){this.element.setStyle(this.options.modifiers[D],this.value.now[D]+this.options.unit);}else{this.element[this.options.modifiers[D]]=this.value.now[D];}}this.fireEvent("drag",this.element);},cancel:function(B){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);if(B){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(B){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(B){this.fireEvent("complete",this.element);}}});Element.implement({makeResizable:function(B){return new Drag(this,$merge({modifiers:{x:"width",y:"height"}},B));}});var Asset=new Hash({javascript:function(J,L){L=$extend({onload:$empty,document:document,check:$lambda(true)},L);var N=new Element("script",{src:J,type:"text/javascript"});var K=L.onload.bind(N),H=L.check,I=L.document;delete L.onload;delete L.check;delete L.document;N.addEvents({load:K,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){K();}}}).setProperties(L);if(Browser.Engine.webkit419){var M=(function(){if(!$try(H)){return ;}$clear(M);K();}).periodical(50);}return N.inject(I.head);},css:function(D,C){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:D},C)).inject(document.head);},image:function(G,H){H=$merge({onload:$empty,onabort:$empty,onerror:$empty},H);var F=new Image();var E=$(F)||new Element("img");["load","abort","error"].each(function(C){var B="on"+C;var A=H[B];delete H[B];F[B]=function(){if(!F){return ;}if(!E.parentNode){E.width=F.width;E.height=F.height;}F=F.onload=F.onabort=F.onerror=null;A.delay(1,E,E);E.fireEvent(C,E,1);};});F.src=E.src=G;if(F&&F.complete){F.onload.delay(1);}return E.setProperties(H);},images:function(F,G){G=$merge({onComplete:$empty,onProgress:$empty},G);if(!F.push){F=[F];}var E=[];var H=0;F.each(function(A){var B=new Asset.image(A,{onload:function(){G.onProgress.call(this,H,F.indexOf(A));H++;if(H==F.length){G.onComplete();}}});E.push(B);});return new Elements(E);}});var Tips=new Class({Implements:[Events,Options],options:{onShow:function(B){B.setStyle("visibility","visible");},onHide:function(B){B.setStyle("visibility","hidden");},showDelay:100,hideDelay:100,className:null,offsets:{x:16,y:16},fixed:false},initialize:function(){var E=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(E.options||null);this.tip=new Element("div").inject(document.body);if(this.options.className){this.tip.addClass(this.options.className);}var F=new Element("div",{"class":"tip-top"}).inject(this.tip);this.container=new Element("div",{"class":"tip"}).inject(this.tip);var D=new Element("div",{"class":"tip-bottom"}).inject(this.tip);this.tip.setStyles({position:"absolute",top:0,left:0,visibility:"hidden"});if(E.elements){this.attach(E.elements);}},attach:function(B){$$(B).each(function(J){var A=J.retrieve("tip:title",J.get("title"));var H=J.retrieve("tip:text",J.get("rel")||J.get("href"));var I=J.retrieve("tip:enter",this.elementEnter.bindWithEvent(this,J));var K=J.retrieve("tip:leave",this.elementLeave.bindWithEvent(this,J));J.addEvents({mouseenter:I,mouseleave:K});if(!this.options.fixed){var L=J.retrieve("tip:move",this.elementMove.bindWithEvent(this,J));J.addEvent("mousemove",L);}J.store("tip:native",J.get("title"));J.erase("title");},this);return this;},detach:function(B){$$(B).each(function(A){A.removeEvent("mouseenter",A.retrieve("tip:enter")||$empty);A.removeEvent("mouseleave",A.retrieve("tip:leave")||$empty);A.removeEvent("mousemove",A.retrieve("tip:move")||$empty);A.eliminate("tip:enter").eliminate("tip:leave").eliminate("tip:move");var D=A.retrieve("tip:native");if(D){A.set("title",D);}});return this;},elementEnter:function(H,E){$A(this.container.childNodes).each(Element.dispose);var F=E.retrieve("tip:title");if(F){this.titleElement=new Element("div",{"class":"tip-title"}).inject(this.container);this.fill(this.titleElement,F);}var G=E.retrieve("tip:text");if(G){this.textElement=new Element("div",{"class":"tip-text"}).inject(this.container);this.fill(this.textElement,G);}this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);this.position((!this.options.fixed)?H:{page:E.getPosition()});},elementLeave:function(B){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this);},elementMove:function(B){this.position(B);},position:function(L){var N=window.getSize(),H=window.getScroll();var K={x:this.tip.offsetWidth,y:this.tip.offsetHeight};var M={x:"left",y:"top"};for(var J in M){var I=L.page[J]+this.options.offsets[J];if((I+K[J]-H[J])>N[J]){I=L.page[J]-this.options.offsets[J]-K[J];}this.tip.setStyle(M[J],I);}},fill:function(C,D){(typeof D=="string")?C.set("html",D):C.adopt(D);},show:function(){this.fireEvent("show",this.tip);},hide:function(){this.fireEvent("hide",this.tip);}});var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(C,D){this.element.scrollTo(C,D);}},initialize:function(D,C){this.setOptions(C);this.element=$(D);this.listener=($type(this.element)!="element")?$(this.element.getDocument().body):this.element;this.timer=null;this.coord=this.getCoords.bind(this);},start:function(){this.listener.addEvent("mousemove",this.coord);},stop:function(){this.listener.removeEvent("mousemove",this.coord);this.timer=$clear(this.timer);},getCoords:function(B){this.page=(this.listener.get("tag")=="body")?B.client:B.page;if(!this.timer){this.timer=this.scroll.periodical(50,this);}},scroll:function(){var J=this.element.getSize(),F=this.element.getScroll(),G=this.element.getPosition(),H={x:0,y:0};for(var I in this.page){if(this.page[I]<(this.options.area+G[I])&&F[I]!=0){H[I]=(this.page[I]-this.options.area-G[I])*this.options.velocity;}else{if(this.page[I]+this.options.area>(J[I]+G[I])&&J[I]+J[I]!=F[I]){H[I]=(this.page[I]-J[I]+this.options.area-G[I])*this.options.velocity;}}}if(H.y||H.x){this.fireEvent("change",[F.x+H.x,F.y+H.y]);}}});
// slimbox
var Slimbox=(function(){var U=window,AM=Browser.Engine.trident4,AF,AT,T=-1,AL,AD,V,AE,AB,N,AH,AN={},AG=new Image(),P=new Image(),R,AZ,AS,AJ,Q,AV,S,AX,Z,O,AC,AR,AW,X;U.addEvent("domready",function(){$(document.body).adopt($$(R=new Element("div",{id:"lbOverlay",events:{click:W}}),AZ=new Element("div",{id:"lbCenter"}),S=new Element("div",{id:"lbBottomContainer"})).setStyle("display","none"));AS=new Element("div",{id:"lbImage"}).injectInside(AZ).adopt(AJ=new Element("div",{styles:{position:"relative"}}).adopt(Q=new Element("a",{id:"lbPrevLink",href:"#",events:{click:Y}}),AV=new Element("a",{id:"lbNextLink",href:"#",events:{click:AU}})));AX=new Element("div",{id:"lbBottom"}).injectInside(S).adopt(new Element("a",{id:"lbCloseLink",href:"#",events:{click:W}}),Z=new Element("div",{id:"lbCaption"}),O=new Element("div",{id:"lbNumber"}),new Element("div",{styles:{clear:"both"}}));});function AA(){var B=U.getScroll(),A=U.getSize();$$(AZ,S).setStyle("left",B.x+(A.x/2));if(AE){R.setStyles({left:B.x,top:B.y,width:A.x,height:A.y});}}function AO(B){["object",AM?"select":"embed"].forEach(function(C){Array.forEach(document.getElementsByTagName(C),function(D){if(B){D._slimbox=D.style.visibility;}D.style.visibility=B?"hidden":D._slimbox;});});R.style.display=B?"":"none";var A=B?"addEvent":"removeEvent";U[A]("scroll",AA)[A]("resize",AA);document[A]("keydown",AK);}function AK(A){var B=A.code;return AF.closeKeys.contains(B)?W():AF.nextKeys.contains(B)?AU():AF.previousKeys.contains(B)?Y():false;}function Y(){return AY(AD);}function AU(){return AY(V);}function AY(A){if(A>=0){T=A;AL=AT[A][0];AD=(T||(AF.loop?AT.length:0))-1;V=((T+1)%AT.length)||(AF.loop?0:-1);AI();AZ.className="lbLoading";AN=new Image();AN.onload=AP;AN.src=AL;}return false;}function AP(){AZ.className="";AW.set(0);AS.setStyles({backgroundImage:"url("+AL+")",display:""});AJ.setStyle("width",AN.width);$$(AJ,Q,AV).setStyle("height",AN.height);Z.set("html",AT[T][1]||"");O.set("html",(((AT.length>1)&&AF.counterText)||"").replace(/{x}/,T+1).replace(/{y}/,AT.length));if(AD>=0){AG.src=AT[AD][0];}if(V>=0){P.src=AT[V][0];}N=AS.offsetWidth;AH=AS.offsetHeight;var A=Math.max(0,AB-(AH/2)),C=0,B;if(AZ.offsetHeight!=AH){C=AR.start({height:AH,top:A});}if(AZ.offsetWidth!=N){C=AR.start({width:N,marginLeft:-N/2});}B=function(){S.setStyles({width:N,top:A+AH,marginLeft:-N/2,visibility:"hidden",display:""});AW.start(1);};if(C){AR.chain(B);}else{B();}}function AQ(){if(AD>=0){Q.style.display="";}if(V>=0){AV.style.display="";}X.set(-AX.offsetHeight).start(0);S.style.visibility="";}function AI(){AN.onload=$empty;AN.src=AG.src=P.src=AL;AR.cancel();AW.cancel();X.cancel();$$(Q,AV,AS,S).setStyle("display","none");}function W(){if(T>=0){AI();T=AD=V=-1;AZ.style.display="none";AC.cancel().chain(AO).start(0);}return false;}Element.implement({slimbox:function(B,A){$$(this).slimbox(B,A);return this;}});Elements.implement({slimbox:function(D,A,B){A=A||function(E){return[E.href,E.title];};B=B||function(){return true;};var C=this;C.removeEvents("click").addEvent("click",function(){var E=C.filter(B,this);return Slimbox.open(E.map(A),E.indexOf(this),D);});return C;}});return{open:function(A,B,C){AF=$extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeTransition:false,initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x} of {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},C||{});AC=new Fx.Tween(R,{property:"opacity",duration:AF.overlayFadeDuration});AR=new Fx.Morph(AZ,$extend({duration:AF.resizeDuration,link:"chain"},AF.resizeTransition?{transition:AF.resizeTransition}:{}));AW=new Fx.Tween(AS,{property:"opacity",duration:AF.imageFadeDuration,onComplete:AQ});X=new Fx.Tween(AX,{property:"margin-top",duration:AF.captionAnimationDuration});if(typeof A=="string"){A=[[A,B]];B=0;}AB=U.getScrollTop()+(U.getHeight()/2);N=AF.initialWidth;AH=AF.initialHeight;AZ.setStyles({top:Math.max(0,AB-(AH/2)),width:N,height:AH,marginLeft:-N/2,display:""});AE=AM||(R.currentStyle&&(R.currentStyle.position!="fixed"));if(AE){R.style.position="absolute";}AC.set(0).start(AF.overlayOpacity);AA();AO(1);AT=A;AF.loop=AF.loop&&(AT.length>1);return AY(B);}};})();Slimbox.scanPage=function(){$$(document.links).filter(function(A){return A.rel&&A.rel.test(/^lightbox/i);}).slimbox({},null,function(A){return(this==A)||((this.rel.length>8)&&(this.rel==A.rel));});};window.addEvent("domready",Slimbox.scanPage);
// jd-gallery
function isBody(B){return(/^(?:body|html)$/i).test(B.tagName);}Element.implement({getPosition:function(G){if(isBody(this)){return{x:0,y:0};}var H=this,E={x:0,y:0};while(H){E.x+=H.offsetLeft;E.y+=H.offsetTop;H=H.offsetParent;}var F=(G)?$(G).getPosition():{x:0,y:0};return{x:E.x-F.x,y:E.y-F.y};}});var gallery={Implements:[Events,Options],options:{showArrows:true,showCarousel:true,showInfopane:true,embedLinks:true,fadeDuration:500,timed:false,delay:9000,preloader:true,preloaderImage:true,preloaderErrorImage:true,manualData:[],populateFrom:false,populateData:true,destroyAfterPopulate:true,elementSelector:"div.imageElement",titleSelector:"h3",subtitleSelector:"p",linkSelector:"a.open",imageSelector:"img.full",thumbnailSelector:"img.thumbnail",defaultTransition:"fade",slideInfoZoneOpacity:0.7,slideInfoZoneSlide:true,carouselMinimizedOpacity:0.4,carouselMinimizedHeight:20,carouselMaximizedOpacity:0.9,thumbHeight:75,thumbWidth:100,thumbSpacing:10,thumbIdleOpacity:0.2,textShowCarousel:"Pictures",showCarouselLabel:true,thumbCloseCarousel:true,useThumbGenerator:false,thumbGenerator:"resizer.php",useExternalCarousel:false,carouselElement:false,carouselHorizontal:true,activateCarouselScroller:true,carouselPreloader:true,textPreloadingCarousel:"Loading...",baseClass:"jdGallery",withArrowsClass:"withArrows",useHistoryManager:false,customHistoryKey:false,useReMooz:false},initialize:function(G,H){this.setOptions(H);this.fireEvent("onInit");this.currentIter=0;this.lastIter=0;this.maxIter=0;this.galleryElement=G;this.galleryData=this.options.manualData;this.galleryInit=1;this.galleryElements=Array();this.thumbnailElements=Array();this.galleryElement.addClass(this.options.baseClass);if(this.options.useReMooz&&(this.options.defaultTransition=="fade")){this.options.defaultTransition="crossfade";}this.populateFrom=G;if(this.options.populateFrom){this.populateFrom=this.options.populateFrom;}if(this.options.populateData){this.populateData();}G.style.display="block";if(this.options.useHistoryManager){this.initHistory();}if((this.options.embedLinks)|(this.options.useReMooz)){this.currentLink=new Element("a").addClass("open").setProperties({href:"#",title:""}).injectInside(G);if((!this.options.showArrows)&&(!this.options.showCarousel)){this.galleryElement=G=this.currentLink;}else{this.currentLink.setStyle("display","none");}}this.constructElements();if((this.galleryData.length>1)&&(this.options.showArrows)){var F=new Element("a").addClass("left").addEvent("click",this.prevItem.bind(this)).injectInside(G);var E=new Element("a").addClass("right").addEvent("click",this.nextItem.bind(this)).injectInside(G);this.galleryElement.addClass(this.options.withArrowsClass);}this.loadingElement=new Element("div").addClass("loadingElement").injectInside(G);if(this.options.showInfopane){this.initInfoSlideshow();}if(this.options.showCarousel){this.initCarousel();}this.doSlideShow(1);},populateData:function(){currentArrayPlace=this.galleryData.length;options=this.options;var B=$A(this.galleryData);B.extend(this.populateGallery(this.populateFrom,currentArrayPlace));this.galleryData=B;this.fireEvent("onPopulated");},populateGallery:function(D,E){var F=[];options=this.options;currentArrayPlace=E;D.getElements(options.elementSelector).each(function(A){elementDict=$H({image:A.getElement(options.imageSelector).getProperty("src"),number:currentArrayPlace,transition:this.options.defaultTransition});if((options.showInfopane)|(options.showCarousel)){elementDict.extend({title:A.getElement(options.titleSelector).innerHTML,description:A.getElement(options.subtitleSelector).innerHTML});}if((options.embedLinks)|(options.useReMooz)){elementDict.extend({link:A.getElement(options.linkSelector).href||false,linkTitle:A.getElement(options.linkSelector).title||false,linkTarget:A.getElement(options.linkSelector).getProperty("target")||false});}if((!options.useThumbGenerator)&&(options.showCarousel)){elementDict.extend({thumbnail:A.getElement(options.thumbnailSelector).getProperty("src")});}else{if(options.useThumbGenerator){elementDict.extend({thumbnail:options.thumbGenerator+"?imgfile="+elementDict.image+"&max_width="+options.thumbWidth+"&max_height="+options.thumbHeight});}}F.extend([elementDict]);currentArrayPlace++;if(this.options.destroyAfterPopulate){A.dispose();}});return F;},constructElements:function(){el=this.galleryElement;if(this.options.embedLinks&&(!this.options.showArrows)){el=this.currentLink;}this.maxIter=this.galleryData.length;var B;for(i=0;i<this.galleryData.length;i++){var B=new Fx.Morph(new Element("div").addClass("slideElement").setStyles({"position":"absolute","left":"0px","right":"0px","margin":"0px","padding":"0px","backgroundPosition":"center center","opacity":"0"}).injectInside(el),{duration:this.options.fadeDuration});if(this.options.preloader){B.source=this.galleryData[i].image;B.loaded=false;B.load=function(D,A){if(!D.loaded){this.galleryData[A].imgloader=new Asset.image(D.source,{"onload":function(F,C){F.element.setStyle("backgroundImage","url('"+F.source+"')");F.loaded=true;F.width=this.galleryData[C].imgloader.width;F.height=this.galleryData[C].imgloader.height;}.pass([D,A],this)});}}.pass([B,i],this);}else{B.element.setStyle("backgroundImage","url('"+this.galleryData[i].image+"')");}this.galleryElements[parseInt(i)]=B;}},destroySlideShow:function(D){var F=D.className;var E=new Element("div").addClass("myClassName");D.parentNode.replaceChild(E,D);},startSlideShow:function(){this.fireEvent("onStart");this.loadingElement.style.display="none";this.lastIter=this.maxIter-1;this.currentIter=0;this.galleryInit=0;this.galleryElements[parseInt(this.currentIter)].set({opacity:1});if(this.options.showInfopane){this.showInfoSlideShow.delay(1000,this);}if(this.options.useReMooz){this.makeReMooz.delay(1000,this);}var B=formatString(this.options.textShowCarousel,this.currentIter+1,this.maxIter);if(this.options.showCarousel&&(!this.options.carouselPreloader)&&(!this.options.useExternalCarousel)){this.carouselBtn.set("html",B).setProperty("title",B);}this.prepareTimer();if(this.options.embedLinks){this.makeLink(this.currentIter);}},nextItem:function(){this.fireEvent("onNextCalled");if(this.options.rande){this.nextIter=Math.floor(Math.random()*this.maxIter);this.goTo(this.nextIter);}else{this.nextIter=this.currentIter+1;if(this.nextIter>=this.maxIter){this.nextIter=0;}this.galleryInit=0;this.goTo(this.nextIter);}},prevItem:function(){this.fireEvent("onPreviousCalled");this.nextIter=this.currentIter-1;if(this.nextIter<=-1){this.nextIter=this.maxIter-1;}this.galleryInit=0;this.goTo(this.nextIter);},goTo:function(B){this.clearTimer();if(this.options.preloader){this.galleryElements[B].load();if(B==0){this.galleryElements[this.maxIter-1].load();}else{this.galleryElements[B-1].load();}if(B==(this.maxIter-1)){this.galleryElements[0].load();}else{this.galleryElements[B+1].load();}}if(this.options.embedLinks){this.clearLink();}if(this.options.showInfopane){this.slideInfoZone.clearChain();this.hideInfoSlideShow().chain(this.changeItem.pass(B,this));}else{this.currentChangeDelay=this.changeItem.delay(500,this,B);}if(this.options.embedLinks){this.makeLink(B);}this.prepareTimer();},changeItem:function(D){this.fireEvent("onStartChanging");this.galleryInit=0;if(this.currentIter!=D){for(i=0;i<this.maxIter;i++){if((i!=this.currentIter)){this.galleryElements[i].set({opacity:0});}}gallery.Transitions[this.galleryData[D].transition].pass([this.galleryElements[this.currentIter],this.galleryElements[D],this.currentIter,D],this)();this.currentIter=D;if(this.options.useReMooz){this.makeReMooz();}}var C=formatString(this.options.textShowCarousel,D+1,this.maxIter);if((this.options.showCarousel)&&(!this.options.useExternalCarousel)){this.carouselBtn.set("html",C).setProperty("title",C);}this.doSlideShow.bind(this)();this.fireEvent("onChanged");},clearTimer:function(){if(this.options.timed){$clear(this.timer);}},prepareTimer:function(){if(this.options.timed){this.timer=this.nextItem.delay(this.options.delay,this);}},doSlideShow:function(B){if(this.galleryInit==1){imgPreloader=new Image();imgPreloader.onload=function(){this.startSlideShow.delay(10,this);}.bind(this);imgPreloader.src=this.galleryData[0].image;if(this.options.preloader){this.galleryElements[0].load();}}else{if(this.options.showInfopane){if(this.options.showInfopane){this.showInfoSlideShow.delay((500+this.options.fadeDuration),this);}else{if((this.options.showCarousel)&&(this.options.activateCarouselScroller)){this.centerCarouselOn(B);}}}}},createCarousel:function(){var D;if(!this.options.useExternalCarousel){var C=new Element("div").addClass("carouselContainer").injectInside(this.galleryElement);this.carouselContainer=new Fx.Morph(C,{transition:Fx.Transitions.Expo.easeOut});this.carouselContainer.normalHeight=C.offsetHeight;this.carouselContainer.set({"opacity":this.options.carouselMinimizedOpacity,"top":(this.options.carouselMinimizedHeight-this.carouselContainer.normalHeight)});this.carouselBtn=new Element("a").addClass("carouselBtn").setProperties({title:this.options.textShowCarousel}).injectInside(C);if(this.options.carouselPreloader){this.carouselBtn.set("html",this.options.textPreloadingCarousel);}else{this.carouselBtn.set("html",this.options.textShowCarousel);}this.carouselBtn.addEvent("click",function(){this.carouselContainer.cancel();this.toggleCarousel();}.bind(this));this.carouselActive=false;D=new Element("div").addClass("carousel").injectInside(C);this.carousel=new Fx.Morph(D);}else{D=$(this.options.carouselElement).addClass("jdExtCarousel");}this.carouselElement=new Fx.Morph(D,{transition:Fx.Transitions.Expo.easeOut});this.carouselElement.normalHeight=D.offsetHeight;if(this.options.showCarouselLabel){this.carouselLabel=new Element("p").addClass("label").injectInside(D);}carouselWrapper=new Element("div").addClass("carouselWrapper").injectInside(D);this.carouselWrapper=new Fx.Morph(carouselWrapper,{transition:Fx.Transitions.Expo.easeOut});this.carouselWrapper.normalHeight=carouselWrapper.offsetHeight;this.carouselInner=new Element("div").addClass("carouselInner").injectInside(carouselWrapper);if(this.options.activateCarouselScroller){this.carouselWrapper.scroller=new Scroller(carouselWrapper,{area:100,velocity:0.2});this.carouselWrapper.elementScroller=new Fx.Scroll(carouselWrapper,{duration:400,onStart:this.carouselWrapper.scroller.stop.bind(this.carouselWrapper.scroller),onComplete:this.carouselWrapper.scroller.start.bind(this.carouselWrapper.scroller)});}},fillCarousel:function(){this.constructThumbnails();this.carouselInner.normalWidth=((this.maxIter*(this.options.thumbWidth+this.options.thumbSpacing+2))+this.options.thumbSpacing)+"px";if(this.options.carouselHorizontal){this.carouselInner.style.width=this.carouselInner.normalWidth;}},initCarousel:function(){this.createCarousel();this.fillCarousel();if(this.options.carouselPreloader){this.preloadThumbnails();}},flushCarousel:function(){this.thumbnailElements.each(function(B){B.element.dispose();B=B.element=null;});this.thumbnailElements=[];},toggleCarousel:function(){if(this.carouselActive){this.hideCarousel();}else{this.showCarousel();}},showCarousel:function(){this.fireEvent("onShowCarousel");this.carouselContainer.start({"opacity":this.options.carouselMaximizedOpacity,"top":0}).chain(function(){this.carouselActive=true;this.carouselWrapper.scroller.start();this.fireEvent("onCarouselShown");this.carouselContainer.options.onComplete=null;}.bind(this));},hideCarousel:function(){this.fireEvent("onHideCarousel");var B=this.options.carouselMinimizedHeight-this.carouselContainer.normalHeight;this.carouselContainer.start({"opacity":this.options.carouselMinimizedOpacity,"top":B}).chain(function(){this.carouselActive=false;this.carouselWrapper.scroller.stop();this.fireEvent("onCarouselHidden");this.carouselContainer.options.onComplete=null;}.bind(this));},constructThumbnails:function(){element=this.carouselInner;for(i=0;i<this.galleryData.length;i++){var B=new Fx.Morph(new Element("div").addClass("thumbnail").setStyles({backgroundImage:"url('"+this.galleryData[i].thumbnail+"')",backgroundPosition:"center center",backgroundRepeat:"no-repeat",marginLeft:this.options.thumbSpacing+"px",width:this.options.thumbWidth+"px",height:this.options.thumbHeight+"px"}).injectInside(element),{duration:200}).start({"opacity":this.options.thumbIdleOpacity});B.element.addEvents({"mouseover":function(A){A.cancel();A.start({"opacity":0.99});if(this.options.showCarouselLabel){$(this.carouselLabel).set("html",'<span class="number">'+(A.relatedImage.number+1)+"/"+this.maxIter+":</span> "+A.relatedImage.title);}}.pass(B,this),"mouseout":function(A){A.cancel();A.start({"opacity":this.options.thumbIdleOpacity});}.pass(B,this),"click":function(A){this.goTo(A.relatedImage.number);if(this.options.thumbCloseCarousel&&(!this.options.useExternalCarousel)){this.hideCarousel();}}.pass(B,this)});B.relatedImage=this.galleryData[i];this.thumbnailElements[parseInt(i)]=B;}},log:function(B){if(console.log){console.log(B);}},preloadThumbnails:function(){var B=[];for(i=0;i<this.galleryData.length;i++){B[parseInt(i)]=this.galleryData[i].thumbnail;}this.thumbnailPreloader=new Preloader();if(!this.options.useExternalCarousel){this.thumbnailPreloader.addEvent("onComplete",function(){var A=formatString(this.options.textShowCarousel,this.currentIter+1,this.maxIter);this.carouselBtn.set("html",A).setProperty("title",A);}.bind(this));}this.thumbnailPreloader.load(B);},clearThumbnailsHighlights:function(){for(i=0;i<this.galleryData.length;i++){this.thumbnailElements[i].cancel();this.thumbnailElements[i].start(0.2);}},changeThumbnailsSize:function(D,C){for(i=0;i<this.galleryData.length;i++){this.thumbnailElements[i].cancel();this.thumbnailElements[i].element.setStyles({"width":D+"px","height":C+"px"});}},centerCarouselOn:function(L){if(!this.carouselWallMode){var J=this.thumbnailElements[L];var H=J.element.offsetLeft+(J.element.offsetWidth/2);var K=this.carouselWrapper.element.offsetWidth;var N=this.carouselInner.offsetWidth;var M=K/2;var I=H-M;this.carouselWrapper.elementScroller.start(I,0);}},initInfoSlideshow:function(){this.slideInfoZone=new Fx.Morph(new Element("div").addClass("slideInfoZone").injectInside($(this.galleryElement))).set({"opacity":0});var D=new Element("h2").injectInside(this.slideInfoZone.element);var C=new Element("p").injectInside(this.slideInfoZone.element);this.slideInfoZone.normalHeight=this.slideInfoZone.element.offsetHeight;this.slideInfoZone.element.setStyle("opacity",0);},changeInfoSlideShow:function(){this.hideInfoSlideShow.delay(10,this);this.showInfoSlideShow.delay(500,this);},showInfoSlideShow:function(){this.fireEvent("onShowInfopane");this.slideInfoZone.cancel();element=this.slideInfoZone.element;element.getElement("h2").set("html",this.galleryData[this.currentIter].title);element.getElement("p").set("html",this.galleryData[this.currentIter].description);if(this.options.slideInfoZoneSlide){this.slideInfoZone.start({"opacity":[0,this.options.slideInfoZoneOpacity],"height":[0,this.slideInfoZone.normalHeight]});}else{this.slideInfoZone.start({"opacity":[0,this.options.slideInfoZoneOpacity]});}if(this.options.showCarousel){this.slideInfoZone.chain(this.centerCarouselOn.pass(this.currentIter,this));}return this.slideInfoZone;},hideInfoSlideShow:function(){this.fireEvent("onHideInfopane");this.slideInfoZone.cancel();if(this.options.slideInfoZoneSlide){this.slideInfoZone.start({"opacity":0,"height":0});}else{this.slideInfoZone.start({"opacity":0});}return this.slideInfoZone;},makeLink:function(B){this.currentLink.setProperties({href:this.galleryData[B].link,title:this.galleryData[B].linkTitle});if(!((this.options.embedLinks)&&(!this.options.showArrows)&&(!this.options.showCarousel))){this.currentLink.setStyle("display","block");}},clearLink:function(){this.currentLink.setProperties({href:"",title:""});if(!((this.options.embedLinks)&&(!this.options.showArrows)&&(!this.options.showCarousel))){this.currentLink.setStyle("display","none");}},makeReMooz:function(){this.currentLink.setProperties({href:"#"});this.currentLink.setStyles({"display":"block"});this.galleryElements[this.currentIter].element.set("title",this.galleryData[this.currentIter].title+" :: "+this.galleryData[this.currentIter].description);this.ReMooz=new ReMooz(this.galleryElements[this.currentIter].element,{link:this.galleryData[this.currentIter].link,shadow:false,dragging:false,addClick:false,resizeOpacity:1});var C=this.galleryElements[this.currentIter];var D=C.element.getCoordinates();delete D.right;delete D.bottom;widthDiff=D.width-C.width;heightDiff=D.height-C.height;D.width=C.width;D.height=C.height;D.left+=Math.ceil(widthDiff/2)+1;D.top+=Math.ceil(heightDiff/2)+1;this.ReMooz.getOriginCoordinates=function(A){return A;}.bind(this,D);this.currentLink.onclick=function(){this.ReMooz.open.bind(this.ReMooz)();return false;}.bind(this);},flushGallery:function(){this.galleryElements.each(function(B){B.element.dispose();B=B.element=null;});this.galleryElements=[];},changeData:function(B){this.galleryData=B;this.clearTimer();this.flushGallery();if(this.options.showCarousel){this.flushCarousel();}this.constructElements();if(this.options.showCarousel){this.fillCarousel();}if(this.options.showInfopane){this.hideInfoSlideShow();}this.galleryInit=1;this.lastIter=0;this.currentIter=0;this.doSlideShow(1);},initHistory:function(){this.fireEvent("onHistoryInit");this.historyKey=this.galleryElement.id+"-picture";if(this.options.customHistoryKey){this.historyKey=this.options.customHistoryKey;}this.history=new History.Route({defaults:[1],pattern:this.historyKey+"\\((\\d+)\\)",generate:function(B){return[this.historyKey,"(",B[0],")"].join("");}.bind(this),onMatch:function(C,D){if(parseInt(C[0])-1<this.maxIter){this.goTo(parseInt(C[0])-1);}}.bind(this)});this.addEvent("onChanged",function(){this.history.setValue(0,this.currentIter+1);this.history.defaults=[this.currentIter+1];}.bind(this));this.fireEvent("onHistoryInited");}};gallery=new Class(gallery);gallery.Transitions=new Hash({fade:function(G,F,E,H){G.options.transition=F.options.transition=Fx.Transitions.linear;G.options.duration=F.options.duration=this.options.fadeDuration;if(H>E){F.start({opacity:1});}else{F.set({opacity:1});G.start({opacity:0});}},crossfade:function(G,F,E,H){G.options.transition=F.options.transition=Fx.Transitions.linear;G.options.duration=F.options.duration=this.options.fadeDuration;F.start({opacity:1});G.start({opacity:0});},fadebg:function(G,F,E,H){G.options.transition=F.options.transition=Fx.Transitions.linear;G.options.duration=F.options.duration=this.options.fadeDuration/2;G.start({opacity:0}).chain(F.start.pass([{opacity:1}],F));}});var Preloader=new Class({Implements:[Events,Options],options:{root:"",period:100},initialize:function(B){this.setOptions(B);},load:function(B){this.index=0;this.images=[];this.sources=this.temps=B;this.total=this.sources.length;this.fireEvent("onStart",[this.index,this.total]);this.timer=this.progress.periodical(this.options.period,this);this.sources.each(function(A,D){this.images[D]=new Asset.image(this.options.root+A,{"onload":function(){this.index++;if(this.images[D]){this.fireEvent("onLoad",[this.images[D],D,A]);}}.bind(this),"onerror":function(){this.index++;this.fireEvent("onError",[this.images.splice(D,1),D,A]);}.bind(this),"onabort":function(){this.index++;this.fireEvent("onError",[this.images.splice(D,1),D,A]);}.bind(this)});},this);},progress:function(){this.fireEvent("onProgress",[Math.min(this.index,this.total),this.total]);if(this.index>=this.total){this.complete();}},complete:function(){$clear(this.timer);this.fireEvent("onComplete",[this.images]);},cancel:function(){$clear(this.timer);}});function formatString(){var J=arguments.length;var F=arguments[0];for(var I=1;I<J;I++){var G="\\{"+(I-1)+"\\}";var H=new RegExp(G,"g");F=F.replace(H,arguments[I]);}return F;}
// jd-gallery transitions
gallery.Transitions.extend({fadeslideleft:function(G,F,E,H){G.options.transition=F.options.transition=Fx.Transitions.Cubic.easeOut;G.options.duration=F.options.duration=1500;if(H>E){F.start({left:[this.galleryElement.offsetWidth,0],opacity:1});G.start({opacity:[1,0]});}else{F.start({opacity:[0,1]});G.start({left:[0,this.galleryElement.offsetWidth],opacity:0}).chain(function(A){A.set({left:0});}.pass(G));}},continuoushorizontal:function(G,F,E,H){G.options.transition=F.options.transition=Fx.Transitions.linear;if(((H>E)||((H==0)&&(E==(this.maxIter-1))))&&(!((H==(this.maxIter-1))&&(E==0)))){G.set({opacity:1});G.start({left:[0,this.galleryElement.offsetWidth*-1]});F.set({opacity:1,left:this.galleryElement.offsetWidth});F.start({left:[this.galleryElement.offsetWidth,0]});}else{G.set({opacity:1});G.start({left:[0,this.galleryElement.offsetWidth]});F.set({opacity:1,left:this.galleryElement.offsetWidth*-1});F.start({left:[this.galleryElement.offsetWidth*-1,0]});}},continuousvertical:function(G,F,E,H){G.options.transition=F.options.transition=Fx.Transitions.linear;if(((H>E)||((H==0)&&(E==(this.maxIter-1))))&&(!((H==(this.maxIter-1))&&(E==0)))){G.set({opacity:1});G.start({top:[0,this.galleryElement.offsetHeight*-1]});F.set({opacity:1,top:this.galleryElement.offsetHeight});F.start({top:[this.galleryElement.offsetHeight,0]});}else{G.set({opacity:1});G.start({top:[0,this.galleryElement.offsetHeight]});F.set({opacity:1,top:this.galleryElement.offsetHeight*-1});F.start({top:[this.galleryElement.offsetHeight*-1,0]});}}});
// script personalizzati
// DECODER
function decode(D){var A="";var B="3h!XU.7naf:x`/9;O?tK*u^2T@&pd_,WL4Q$PV0-eoM1wCFkHsJjlg%6SYBqm=b5A";var C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@.0123456789 ";for(i=0;i<D.length;i++){current=D.charAt(i);idx=B.indexOf(current);nextVal=(idx==-1)?current:C.charAt(idx);A+=nextVal;}return A;}
// HEADEFFECTS
function addGlobalEffects(){var E=70,D=70,A=130;var B=$$("#sectionbars .sectionbar");var C=new Fx.Elements(B,{wait:false,duration:300,transition:Fx.Transitions.Back.easeOut});B.each(function(G,F){G.addEvent("mouseenter",function(H){var I={};I[F]={width:[G.getStyle("width").toInt(),A],background:"url(img/divisore_blu.gif) no-repeat"};B.each(function(J,L){if(F!=L){var K=J.getStyle("width").toInt();if(K!=D){I[L]={width:[K,D],background:"url(img/barraGrigia.gif) no-repeat"};}}});C.start(I);});});$("sectionbars").addEvent("mouseleave",function(F){var G={};B.each(function(I,H){G[H]={width:[I.getStyle("width").toInt(),E],background:"url(img/barraGrigia.gif) no-repeat"};});C.start(G);});}function sottomenuConFading(C,B,A){$(C).fade("hide");$(B).addEvent("mouseenter",function(){var D=$(B).getPosition();$(C).setPosition({x:D.x,y:D.y+A});$(C).fade(0.9);});$(B).addEvent("mouseleave",function(){$(C).fade("out");});$(C).addEvent("mouseenter",function(){$(C).fade("in");});$(C).addEvent("mouseleave",function(){$(C).fade("out");});}window.addEvent("domready",function(){addGlobalEffects();sottomenuConFading("submenuReparti","menuReparti",25);});
// COOKIECHECK
function cookieAttivi(){ris=false;var A=Cookie.write("testCookie","test");if(Cookie.read("testCookie")=="test"){ris=true;Cookie.dispose(A);}return ris;}