gallery.Transitions.extend({
        slide: function(oldFx, newFx, oldPos, newPos) {
                oldFx.options.transition = newFx.options.transition = Fx.Transitions.Quad.easeInOut;
                oldFx.options.duration = newFx.options.duration = this.options.fadeDuration;
                var w = this.galleryElement.offsetWidth;
                
                if(this._transitionMode != 'previous') {
                    newFx.start({ left: [ w, 0 ], opacity: [ 1, 1 ] });
                    oldFx.start({ left: [ 0, -w ] });
                }
                else {
                    newFx.start({ left: [ -w, 0 ], opacity: [ 1, 1 ] });
                    oldFx.start({ left: [ 0, w ] });
                }
                
                this._transitionMode = undefined;
        }
});
        
function startGallery() {
        var myGallery = new gallery($('gallery'), {
            defaultTransition: 'slide',
            fadeDuration: 400,
            timed: true,
            delay: 12000,
            showInfopane: false,
            showCarousel: false,
            embedLinks: false
        });
        
        myGallery.addEvent('onNextCalled', function() {
            this._transitionMode = 'next';
        });
        myGallery.addEvent('onPreviousCalled', function() {
            this._transitionMode = 'previous';
        });
}
window.addEvent('domready',startGallery);
