var tourContainer = null,
    lastLink = null,
    lastStop = null,
	testStops = [],
	scrollIndex = 0,
	scrollMax = 13;

window.addEvent('load', function() {

    tourContainer = $('tour');

    tourContainer.links = $ES('li','reason-menu');
    lastLink = $(tourContainer.links[0]);

    tourContainer.content = $ES('div','tour');
    lastStop = $(tourContainer.content[0]);

    lastStop.className = 'show';

    for (var i = 0; i < 5; i++) {
        var tour = $(tourContainer.content[i]);
        tour.outfx = tour.effects({duration: 1000, transition:
Fx.Transitions.Quart.easeOut});
        tour.infx = tour.effects({duration: 500, transition:
Fx.Transitions.Quart.easeIn});

        if (0 < i) {
            tour.outfx.start({
                'opacity': 0
            });
        }

        $(tourContainer.links[i]).addEvent('click', function() {
			if (lastLink == this) {return;}
            lastLink.className = '';
            this.className = 'current';

            var ltour = tourContainer.content[lastLink.id.replace('l','')],
                ntour = tourContainer.content[this.id.replace('l','')];

            lastLink = this;

            ltour.outfx.start({
                'opacity': 0
            }).chain(function() {
                ntour.className = 'show';
                ltour.className = '';
                // executes immediately after completion of above effect
                ntour.infx.start({
                    'opacity': 1
                });
            });

        });

    }
	
	/*var scroller = $('testimonial-scroller');
	scroller.cnodes = scroller.getElements('div[id!=author]');
		
	for (var i=scroller.cnodes.length-1; 0<=i; i--) {
		var cn = $(scroller.cnodes[i]);
		cn.outfx = cn.effects({duration: 1000, transition: Fx.Transitions.Quart.easeOut});
		cn.infx = cn.effects({duration: 500, transition: Fx.Transitions.Quart.easeIn});
		scroller.cnodes[i] = cn;
		
		if (0 != i) {
			cn.outfx.start({
				'opacity': 0
			});
		}
	}
	*/

	/*
	$('testimonial-next').addEvent('click', function(e) {
		var evt = new Event(e),
			fadeNode = scroller.cnodes[scrollIndex];
		evt.stop();
		if (++scrollIndex > scrollMax) {scrollIndex = 1;}
		var newNode = scroller.cnodes[scrollIndex];
		
		// ensures that the node we are about to fade in has a ZERO opacity
		newNode.style.display = 'block';
		
		// hide visible node
		fadeNode.outfx.start({
            'opacity': 0
        }).chain(function() {
            fadeNode.style.display = 'none';
            // executes immediately after completion of above effect
            newNode.infx.start({
                'opacity': 1
            });
        });
	});
	*/
});