var accordion="";var accordion2="";window.addEvent("domready",function(){accordion=new Accordion("span.toggle","ul.content",{display:false,alwaysHide:true,opacity:false,onActive:function(e,d){e.addClass("act");parentelement=d},onBackground:function(e,d){e.removeClass("act")}});accordion2=new Accordion("span.toggle2","ul.content2",{display:false,alwaysHide:true,opacity:false,onActive:function(e,d){e.addClass("act2");parentelement.setStyle("height","auto")},onBackground:function(e,d){e.removeClass("act2")}});function b(){var e=false;var f=0;var d=0;$$("#rgaccordmenu li span.toggle").each(function(g,h){if(g.hasClass("open")&&!e){accordion.display(f);e=true}else{f++}});if(!e){accordion.display(0)}}function c(){var e=false;var f=0;var d=0;$$(" span.toggle2").each(function(g,h){if(g.hasClass("open")&&!e){accordion2.display(f);e=true}else{f++}})}var a=new Chain();a.chain(b);a.chain(c);a.callChain();a.callChain.delay(1500,a)});var Slimbox;(function(){var A=0,y,w,u,r,n,k,m,f,z=new Image(),x=new Image(),v,s,o,l,t,p,j,i,e,d,c,b;window.addEvent("domready",function(){$(document.body).adopt($$([v=new Element("div",{id:"lbOverlay"}).addEvent("click",C),s=new Element("div",{id:"lbCenter"}),j=new Element("div",{id:"lbBottomContainer"})]).setStyle("display","none"));o=new Element("div",{id:"lbImage"}).injectInside(s).adopt(t=new Element("a",{id:"lbPrevLink",href:"#"}).addEvent("click",h),p=new Element("a",{id:"lbNextLink",href:"#"}).addEvent("click",E));l=new Element("iframe",{id:"lbImage"}).addEvent("load",a).injectInside(o);i=new Element("div",{id:"lbBottom"}).injectInside(j).adopt(new Element("a",{id:"lbCloseLink",href:"#"}).addEvent("click",C),c=new Element("a",{id:"lbPrintLink",href:"#"}).addEvent("click",g),b=new Element("a",{id:"lbSaveLink",href:"#"}).addEvent("click",G),e=new Element("div",{id:"lbCaption"}),d=new Element("div",{id:"lbNumber"}),new Element("div",{styles:{clear:"both"}}));m={overlay:new Fx.Tween(v,{property:"opacity",duration:500}).set(0),image:new Fx.Tween(o,{property:"opacity",duration:500,onComplete:a}),bottom:new Fx.Tween(i,{property:"margin-top",duration:400})}});Slimbox={open:function(K,J,L){y=$extend({loop:false,overlayOpacity:0.8,resizeDuration:400,resizeTransition:false,initialWidth:250,initialHeight:250,psScriptPath:"",enablePrintButton:0,enableSaveButton:0,animateCaption:true,showCounter:true,counterText:"Item {x} of {y}",defaultIframeWidth:850,defaultIframeHeight:500},L||{});if(typeof K=="string"){K=[[K,J]];J=0}w=K;y.loop=y.loop&&(w.length>1);I();D(true);k=window.getScrollTop()+(window.getHeight()/15);m.resize=new Fx.Morph(s,$extend({duration:y.resizeDuration,onComplete:a},y.resizeTransition?{transition:y.resizeTransition}:{}));s.setStyles({top:k,width:y.initialWidth,height:y.initialHeight,marginLeft:-(y.initialWidth/2),display:""});m.overlay.start(y.overlayOpacity);A=1;return F(J)}};Element.implement({slimbox:function(K,J){$$(this).slimbox(K,J);return this}});Elements.implement({slimbox:function(M,L,K){L=L||function(N){return[N.href,N.title,N.rev]};K=K||function(){return true};var J=this;J.removeEvents("click").addEvent("click",function(){var N=J.filter(K,this);return Slimbox.open(N.map(L),N.indexOf(this),M)});return J}});function I(){v.setStyles({top:window.getScrollTop(),height:window.getHeight()})}function D(K){["object",window.ie?"select":"embed"].forEach(function(L){Array.forEach(document.getElementsByTagName(L),function(M){if(K){M._slimbox=M.style.visibility}M.style.visibility=K?"hidden":M._slimbox})});v.style.display=K?"":"none";var J=K?"addEvent":"removeEvent";window[J]("scroll",I)[J]("resize",I);document[J]("keydown",H)}function H(J){switch(J.code){case 27:case 88:case 67:C();break;case 37:case 80:h();break;case 39:case 78:E()}return false}function h(){return F(r)}function E(){return F(n)}function F(K){if((A==1)&&(K>=0)){A=2;u=K;r=((u||!y.loop)?u:w.length)-1;n=u+1;if(n==w.length){n=y.loop?0:-1}$$(t,p,o,l,j).setStyle("display","none");m.bottom.cancel().set(0);m.image.set(0);s.className="lbLoading";var J=w[u][0];var L=/\.(jpe?g|png|gif|bmp)/i;if(J.match(L)){$$(c,b).setStyle("display","");f=new Image();f.datatype="image";f.onload=a;f.src=J}else{$$(c,b).setStyle("display","none");f=new Object();f.datatype="iframe";rev=w[u][2];f.w=q(rev,new RegExp("width=(\\d+)","i"),y.defaultIframeWidth);f.h=q(rev,new RegExp("height=(\\d+)","i"),y.defaultIframeHeight);l.setProperties({id:"lbFrame_"+new Date().getTime(),width:f.w,height:f.h,scrolling:"yes",frameBorder:0,src:J})}}return false}function a(){switch(A++){case 2:s.className="";if(f.datatype=="image"){o.setStyles({backgroundImage:"url("+f.src+")",display:""});$$(o,i).setStyle("width",f.width);$$(o,t,p).setStyle("height",f.height);$$(t,p).setStyle("width","50%")}else{o.setStyles({backgroundImage:"",display:""});$$(o,i).setStyle("width",f.w);$$(o).setStyle("height",f.h);$$(t,p).setStyle("height","35px");$$(t,p).setStyle("width","65px");l.setStyles({display:""})}e.set("html",w[u][1]||"");d.set("html",(y.showCounter&&(w.length>1))?y.counterText.replace(/{x}/,u+1).replace(/{y}/,w.length):"");if(r>=0){z.src=w[r][0]}if(n>=0){x.src=w[n][0]}if(s.clientHeight!=o.offsetHeight){m.resize.start({height:o.offsetHeight});break}A++;case 3:if(s.clientWidth!=o.offsetWidth){m.resize.start({width:o.offsetWidth,marginLeft:-o.offsetWidth/2});break}A++;case 4:j.setStyles({top:k+s.clientHeight,marginLeft:s.style.marginLeft,visibility:"hidden",display:""});m.image.start(1);break;case 5:if(r>=0){t.style.display=""}if(n>=0){p.style.display=""}if(y.animateCaption){m.bottom.set(-i.offsetHeight).start(0)}j.style.visibility="";A=1}}function C(){if(A){A=0;f.onload=$empty;for(var J in m){m[J].cancel()}$$(s,j).setStyle("display","none");m.overlay.chain(D).start(0)}return false}function q(M,K,L){var J=M.match(K);return J?J[1]:L}function g(){return B("print")}function G(){return B("save")}function B(K){if(y.psScriptPath){var J=window.open(y.psScriptPath+"?mode="+K+"&image="+w[u][0],"printsave","left=0,top=0,width="+(parseInt(o.style.width))+",height="+(parseInt(o.style.height))+",toolbar=0,resizable=1");return false}return true}})();