/**
Script: Slideshow.Push.js
	Slideshow.Push - Push extension for Slideshow.

License:
	MIT-style license.

Copyright:
	Copyright (c) 2008 [Aeron Glemann](http://www.electricprism.com/aeron/).
*/

Slideshow.Push = new Class({
    Extends: Slideshow,
    initialize: function(B, C, A) {
        A.overlap = true;
        this.parent(B, C, A)
    },
    _show: function(C) {
        var A = [this.image, ((this.counter % 2) ? this.a: this.b)];
        if (!this.image.retrieve("fx")) {
            this.image.store("fx", new Fx.Elements(A, {
                duration: this.options.duration,
                link: "cancel",
                onStart: this._start.bind(this),
                onComplete: this._complete.bind(this),
                transition: this.options.transition
            }))
        }
        this.image.set("styles", {
            left: "auto",
            right: "auto"
        }).setStyle(this.direction, this.width).setStyle("visibility", "visible");
        var B = {
            "0": {},
            "1": {}
        };
        B["0"][this.direction] = [this.width, 0];
        B["1"][this.direction] = [0, -this.width];
        if (A[1].getStyle(this.direction) == "auto") {
            var D = this.width - A[1].width;
            A[1].set("styles", {
                left: "auto",
                right: "auto"
            }).setStyle(this.direction, D);
            B["1"][this.direction] = [D, -this.width]
        }
        if (C) {
            for (var E in B) {
                B[E][this.direction] = B[E][this.direction][1]
            }
            this.image.retrieve("fx").cancel().set(B)
        } else {
            this.image.retrieve("fx").start(B)
        }
    }
});