var Slideshow=new Class({setOptions:function(A){this.options={firstPeriod:5000,otherPeriod:8000,fxDuration:500,mediaBufferId:"slideshowbuffer",captionId:"slideshowcaption",loop:true};
Object.extend(this.options,A||{})},initialize:function(H,G,A,E,F,C,B,I){this.updateId=H;
this.imagearray=F;
this.captionarray=C;
this.linkarray=B;
this.parentObj=G;
this.setOptions(I);
this.currentShow=(this.options.startingPlace)?this.options.startingPlace:1;
this.fxMethod=(this.options.fxMethod)?this.options.fxMethod:"opacity";
this.fxStart=(this.options.fxStart)?this.options.fxStart:1;
this.fxEnd=(this.options.fxEnd)?this.options.fxEnd:0;
if(A==null&&E==null){this.options.usetriggers=false}else{this.options.usetriggers=true;
this.nexttrigger=A;
this.prevtrigger=E}if(C!=null){var D=new Element("p");
D.id=this.options.captionId;
D.setHTML(this.captionarray[0]);
this.parentObj.adopt(D)}this.preload(0)},createOverlay:function(){if($(this.options.mediaBufferId)){$(this.options.mediaBufferId).remove()}var A=new Element("img");
A.id=this.options.mediaBufferId;
this.parentObj.adopt(A)},preload:function(B){if(B<this.imagearray.length){var A=new Element("img");
A.onload=function(){this.preload((B+1));
delete A}.bind(this);
A.src=this.imagearray[B]}else{this.timerAction(true,true)}},timerAction:function(B,A){if(B&&this.options.usetriggers){if(this.nexttrigger!=null){this.nexttrigger.onclick=function(){this.timer=$clear(this.timer);
this.currentShow=((this.currentShow+1)>this.imagearray.length)?1:++this.currentShow;
this.createOverlay();
$(this.options.mediaBufferId).src=this.updateId.src;
this.updateId.src=this.imagearray[this.currentShow-1];
this.updateId.getParent().href=this.linkarray[this.currentShow-1];
if(this.captionarray!=null){$(this.options.captionId).setHTML(this.captionarray[this.currentShow-1])}var C=new Fx.Style($(this.options.mediaBufferId),this.fxMethod,{duration:this.options.fxDuration});
C.custom(this.fxStart,this.fxEnd);
this.timer=$clear(this.timer);
if(A){this.timer=(B)?this.transition.delay(this.options.firstPeriod,this):this.transition.delay(this.options.otherPeriod,this)}}.bind(this)}if(this.prevtrigger!=null){this.prevtrigger.onclick=function(){this.timer=$clear(this.timer);
this.currentShow=((this.currentShow-1)<=0)?this.imagearray.length:--this.currentShow;
this.createOverlay();
$(this.options.mediaBufferId).src=this.updateId.src;
this.updateId.src=this.imagearray[this.currentShow-1];
this.updateId.getParent().href=this.linkarray[this.currentShow-1];
if(this.captionarray!=null){$(this.options.captionId).setHTML(this.captionarray[this.currentShow-1])}var C=new Fx.Style($(this.options.mediaBufferId),this.fxMethod,{duration:this.options.fxDuration});
C.custom(this.fxStart,this.fxEnd);
this.timer=$clear(this.timer);
if(A){this.timer=(B)?this.transition.delay(this.options.firstPeriod,this):this.transition.delay(this.options.otherPeriod,this)}}.bind(this)}}this.timer=$clear(this.timer);
if(A){this.timer=(B)?this.transition.delay(this.options.firstPeriod,this):this.transition.delay(this.options.otherPeriod,this)}},loopcheck:function(){if(!this.options.loop&&this.currentShow==1){return false}else{return true}},transition:function(){this.currentShow=((this.currentShow+1)>this.imagearray.length)?1:++this.currentShow;
if(!this.loopcheck()){this.timerAction(false,false)}else{this.createOverlay();
$(this.options.mediaBufferId).src=this.updateId.src;
this.updateId.src=this.imagearray[this.currentShow-1];
this.updateId.getParent().href=this.linkarray[this.currentShow-1];
if(this.captionarray!=null){$(this.options.captionId).setHTML(this.captionarray[this.currentShow-1])}var A=new Fx.Style($(this.options.mediaBufferId),this.fxMethod,{duration:this.options.fxDuration});
A.custom(this.fxStart,this.fxEnd);
this.timerAction(false,true)}}})