function Animation(C,A,D,B){this.img=A;this.animationManager=C;this.seconds=D;this.effects=B;this.startMS=0}Animation.prototype.start=function(){this.animationManager.add(this);this.startMS=0;this.img.hide();for(var A in this.effects){this.effects[A].apply(0)}this.img.show()};Animation.prototype.animate=function(){var C=new Date();if(this.startMS==0){this.startMS=C.valueOf()}var B=(((C.valueOf()-this.startMS)/1000)/this.seconds)*100;for(var A in this.effects){this.effects[A].apply(B)}};Animation.prototype.done=function(){var A=new Date();return((A.valueOf()-this.startMS)/1000)>this.seconds};function AnimationManager(B){this.animations=[];var A=this;window.setInterval(function(){A.idle()},B)}AnimationManager.prototype.add=function(A){this.animations.push(A)};AnimationManager.prototype.idle=function(){if(this.animations.length>0){this.animations[0].animate();if(this.animations[0].done()){this.animations.shift()}if(this.animations.length==0){this.on_finished()}}};AnimationManager.prototype.on_finished=function(){};function SlideShow(B,A,D,C,E){this.g_current_slide=0;this.g_slides=[];this.g_width=D;this.g_height=C;this.g_slidesUrl=B;this.g_imageContainer=A;this.g_animationManager=new AnimationManager(E);this.g_animationManager.show=this;this.g_animationManager.on_finished=function(){this.show.g_current_slide++;if(this.show.g_current_slide>=this.show.g_slides.length){this.show.g_current_slide=0}this.show.g_slides[this.show.g_current_slide].start()};this.isRunning=false;this.offset=0;this.limit=20}SlideShow.prototype.rnd=function(B,A){return(Math.random()*(A-B))+B};SlideShow.prototype.load_slides=function(A,H){var B=document.getElementById(A);var K=document.getElementById("loading");if(K!=null){B.innerHTML=""}for(var F in H){var G=H[F];var C=document.createElement("p");C.style.position="absolute";C.style.top="10px";C.style.left="1px";C.style.width=(this.g_width-2)+"px";C.style.align="center";C.style.display="none";var J=document.createElement("a");J.href=G.link;var E=document.createElement("img");E.style.align="top";E.border="0";J.appendChild(E);C.appendChild(J);var D=document.createElement("h4");D.innerHTML=G.desc;D.style.color="#FFFFFF";C.appendChild(D);B.appendChild(C);var I=new ImageInfo(G.src,G.width,G.height,G.caption,G.desc,E,C);this.g_slides.push(new Animation(this.g_animationManager,I,5,[new KenBurnsFader(I,30)]))}};SlideShow.prototype.start_slides=function(){if(this.g_current_slide!=null&&this.g_slides!=null&&this.g_slides[this.g_current_slide]!=null){this.g_slides[this.g_current_slide].start()}};SlideShow.prototype.getNextSet=function(){if(this.offset>10){return }var A=this;Minglebox.Request.process(null,null,function(C,B){A.slideShowCallback(C,B)},null,this.g_slidesUrl+"&offset="+this.offset+"&limit="+this.limit,null,null)};SlideShow.prototype.slideShowCallback=function(M,L){if(!L.status||L.status!="success"){alert(L.message);return }var G=[];var B=L.results;for(var E=0;E<B.length;E++){var I=B[E];var A="";var C=240;var J=240;var K="";var H="";var F="";for(var D=0;D<I.length;D++){if(I[D].name=="src"){A=I[D].value}if(I[D].name=="width"){C=parseInt(I[D].value)}if(I[D].name=="height"){J=parseInt(I[D].value)}if(I[D].name=="caption"){K=I[D].value}if(I[D].name=="link"){H=I[D].value}if(I[D].name=="description"){F=I[D].value}}G.push({src:A,width:C,height:J,caption:K,link:H,desc:F})}this.load_slides(this.g_imageContainer,G);if(!this.isRunning){this.isRunning=true;this.start_slides()}if(B.length==this.limit){this.offset+=this.limit;this.getNextSet()}};function ImageInfo(G,C,A,B,D,E,F){this.src=G;this.width=C;this.height=A;this.caption=B;this.description=D;this.current_width=C;this.current_height=A;this.htmlObj=E;this.htmlObj.src=this.src;this.htmlObj.alt=B;this.pObj=F}ImageInfo.prototype.set_opacity=function(A){this.pObj.style.MozOpacity=A/100;this.pObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+A+")"};ImageInfo.prototype.set_position=function(A,B){this.htmlObj.style.left=A+"px";this.htmlObj.style.top=B+"px"};ImageInfo.prototype.set_size=function(A,B){this.current_width=A;this.current_height=B;this.htmlObj.width=this.current_width;this.htmlObj.height=this.current_height};ImageInfo.prototype.get_image=function(){return this.htmlObj};ImageInfo.prototype.hide=function(){this.pObj.style.display="none"};ImageInfo.prototype.show=function(){this.pObj.style.display="block"};function KenBurnsFader(A,B){this.img=A;this.windowSize=B}KenBurnsFader.prototype.apply=function(B){var A=100;if(B<=this.windowSize){A=(B/this.windowSize)*100}else{if(B>=(100-this.windowSize)){A=((100-B)/this.windowSize)*100}}this.img.set_opacity(A)};function slideShowCallback(B,A){B.slideShowCallback(A)}function doSlideShow(B,A,D,C,F){var E=new SlideShow(B,A,D,C,F);E.getNextSet()};