﻿Slideshow.KenBurns=new Class({Extends:Slideshow,options:{pan:[100,100],zoom:[50,50]},initialize:function(c,b,a){a.overlap=true;a.resize=true;["pan","zoom"].each(function(a){if($chk(this[a])){if($type(this[a])!="array")this[a]=[this[a],this[a]];this[a].map(function(a){return (a.toInt()||0).limit(0,100)})}},a);this.parent(c,b,a)},_show:function(d){if(!this.image.retrieve("morph"))["a","b"].each(function(a){this[a].set("tween",{duration:this.options.duration,link:"cancel",onStart:this._start.bind(this),onComplete:this._complete.bind(this),property:"opacity"}).get("morph",{duration:this.options.delay+this.options.duration*2,link:"cancel",transition:$arguments(0)})},this);this.image.set("styles",{bottom:"auto",left:"auto",right:"auto",top:"auto"});var c=(["top left","top right","bottom left","bottom right"])[this.counter%4].split(" ");c.each(function(a){this.image.setStyle(a,0)},this);dh=this.height/this.preloader.height;dw=this.width/this.preloader.width;delta=dw>dh?dw:dh;var a={},e=$random.run(this.options.zoom)/100+1,f=Math.abs($random.run(this.options.pan)/100-1);["height","width"].each(function(d,h){var b=Math.ceil(this.preloader[d]*delta),g=(b*e).toInt();a[d]=[g,b];if(dw>dh||h){b=this[d]-this.image[d];g=(b*f).toInt();a[c[h]]=[g,b]}},this);var b=this.firstrun&&this.options.paused;if(d||b){this._center(this.image);this.image.get("morph").cancel();if(b)this.image.get("tween").cancel().set(0).start(1);else this.image.get("tween").cancel().set(1)}else{this.image.get("morph").start(a);this.image.get("tween").set(0).start(1)}}})