prepare_gallery=function(){var list=$("gallery_images");if(!list){return}list.hide();var link=list.down("a",0);var gallery_link=new Element("a",{href:"#","class":"icon_gallery"}).update("View Gallery");var p=new Element("p",{id:"gallery_link"});p.insert(gallery_link);list.previous().insert(p);gallery_link.observe("click",start_lightbox.bind(link));var page_images=$$("p.alt img");if(page_images.length){list.select("a").each(function(a){pos=a.href.indexOf("_simg_");if(pos!=-1){pos+=6;end=a.href.indexOf(".",pos);index=a.href.substr(pos,end-pos)-1;if(page_images[index]){anchor=page_images[index].wrap("a",{href:"#"});anchor.observe("click",start_lightbox.bind(a))}}})}};start_lightbox=function(e){e.stop();window.lightbox.start(this)};var Slideshow=Class.create({initialize:function(options){options.id=options.id||"slideshow";this.slideshow=$(options.id);if(!this.slideshow){throw ("Attempted to initalize slideshow with undefined element: "+options.id)}this.slideIDPrefix=options.slideClass||"slide";this.duration=options.duration||8;this.isAnimating=false;this.current=0;var img=this.slideshow.down("img");this.slides=[img];total=options.images.length;for(i=0;i<total;++i){alt=options.alts?options.alts[i]:"Image Slide "+(i+1)+" of "+total;img=new Element("img",{src:options.images[i],alt:alt,style:"display:none;"});this.slideshow.insert(img);this.slides.push(img)}this.pe=new PeriodicalExecuter(this.animate.bind(this),this.duration)},animate:function(){var next=(this.current==this.slides.length-1)?0:this.current+1;new Effect.Parallel([new Effect.Fade(this.slides[this.current],{sync:true}),new Effect.Appear(this.slides[next],{sync:true})],{duration:2.5,afterFinish:function(){this.current=next}.bind(this)})}});
