window.addEvent("load",function(){$$(".ps-slideshow").each(function(e){var k=e.getElements(".ps-slideshow-frame");var q=k.length;var c=e.get("class");var l=5000;var b;var d;var n=false;var m=1;var i=function(u,r){var s=u.getFirst().getChildren(".ps-slideshow-current")[0];if(r&&r=="previous"){var t=s.getPrevious();if(!t){t=k[k.length-1]}}else{if(!r||(r&&r=="next")){var t=s.getNext();if(!t){t=k[0]}}}t.setStyle("opacity",0);t.setStyle("z-index",(s.getStyle("z-index")*1)+1);b=new Fx.Tween(t,{duration:650,transition:Fx.Transitions.Sine.easeIn,onComplete:function(){n=false}});d=new Fx.Tween(s,{duration:100,transition:Fx.Transitions.Sine.easeIn,onComplete:function(){if(r&&r=="previous"){m--;if(m<=0){m=k.length}}else{if(!r||(r&&r=="next")){m++;if(m>k.length){m=1}}}var v=u.getElements(".ps-slideshow-currentframe");if(v){v.set("text",m)}}});n=true;d.start("opacity",1,0);b.start("opacity",0,1).chain(function(){s.removeClass("ps-slideshow-current");t.addClass("ps-slideshow-current")})};if(!c.contains("no-rotate")){if(c.contains("ps-config-speed-")){var p=c.indexOf("ps-config-speed-");var j=c.indexOf(" ",p);if(j==-1){j=c.length}if(j>-1){l=c.substring(p+16,j)}}var g=e.getElement(".ps-button-previous");if(g){g.addEvent("click",function(r){r.stop();if(b&&!n){b.cancel();$clear(h);i(e,"previous")}else{if(!b){$clear(h);i(e,"previous")}}})}var f=e.getElement(".ps-button-next");if(f){f.addEvent("click",function(r){r.stop();if(b&&!n){b.cancel();$clear(h);i(e,"next")}else{if(!b){$clear(h);i(e,"next")}}})}var o=e.getElement(".ps-button-pause");if(o){o.addEvent("click",function(r){r.stop();$clear(h)})}var a=e.getElement(".ps-button-play");if(a){a.addEvent("click",function(r){r.stop();$clear(h);h=i.periodical(l,null,e)})}var h;if(!c.contains("ps-config-stopped")){h=i.periodical(l,null,e)}}})});