Slideshow.Fold=new Class({Extends: Slideshow,
options:{},
initialize: function(el, data, options){this.parent(el, data, options);},
_show: function(fast){if (!this.image.retrieve('tween')){var options=(this.options.overlap) ?{'duration': this.options.duration}:{'duration': this.options.duration / 2};
$$(this.a, this.b).set('tween', $merge(options,{'link':'chain', 'property':'clip', 'transition': this.options.transition}));}
var rect=this._rect(this.image);
var img=(this.counter % 2) ? this.a : this.b;
if (fast){img.get('tween').cancel().set('rect(0, 0, 0, 0)');
this.image.setStyle('visibility', 'visible').get('tween').cancel().set('auto');}
else{if (this.options.overlap){img.setStyle('visibility', 'visible').get('tween').set('auto');
var tween=this.image.setStyle('visibility', 'visible').get('tween').set(rect.top+' '+rect.left+' '+Math.ceil(rect.bottom / 2)+' '+rect.left).start(rect.top+' '+rect.right+' '+Math.ceil(rect.bottom / 2)+' '+rect.left).start(rect.top+' '+rect.right+' '+rect.bottom+' '+rect.left);}
else{var fn=function(rect){this.image.setStyle('visibility', 'visible').get('tween').set(rect.top+' '+rect.left+' '+Math.ceil(rect.bottom / 2)+' '+rect.left).start(rect.top+' '+rect.right+' '+Math.ceil(rect.bottom / 2)+' '+rect.left).start(rect.top+' '+rect.right+' '+rect.bottom+' '+rect.left);}.pass(rect, this);
var rect=this._rect(img);
img.setStyle('visibility', 'visible').get('tween').set(rect.top+' '+rect.right+' '+rect.bottom+' '+rect.left).start(rect.top+' '+rect.right+' '+Math.ceil(rect.bottom / 2)+' '+rect.left).start(rect.top+' '+rect.left+' '+Math.ceil(rect.bottom / 2)+' '+rect.left).chain(fn);}}},
_rect: function(img){var rect=img.getCoordinates(this.slideshow.retrieve('images'));
rect.right=(rect.right > this.width) ? this.width - rect.left : rect.width;
rect.bottom=(rect.bottom > this.height) ? this.height - rect.top : rect.height;
rect.top=(rect.top < 0) ? Math.abs(rect.top) : 0;
rect.left=(rect.left < 0) ? Math.abs(rect.left) : 0;
return rect;}});
