/*
function autoSlide(){
	setTimeout("autoSlide()", 5000);
	imgs = $$('.img.main');
	fx.start('margin-left',-width).chain(function(){
		wrap.setStyle('margin-left',0);
		imgs[0].dispose().inject(wrap);
		imgs = $$('.img.main');
	});
};

function autoShow(){
	imgs[currentIndex++].set("tween", {
		duration: 2000
	}).tween("opacity", 0);
	imgs[currentIndex %= imgs.length].set("tween", {
		duration: 2000
	}).tween("opacity", 1);
};

window.addEvent('domready', function() {
	cont = $('imgcontainer');
	imgs = $$('.img.main');
	wrap = $('imgwrapper');
	currentIndex = 0;
	fx = new Fx.Tween(wrap, {duration: '500', unit: 'px'});
	getSize();
//	autoSlide();
	autoShow.periodical(3000);
});

window.onresize = function(){
	getSize();
};

var getSize = function(){
	var size = cont.getSize();
	width = size.x;
	imgs.setStyle('width',width);
	wrap.setStyle('width',(width*4)+50);

};
*/

window.addEvent("load", function() {
    var duration = 3000;
	container = $("slideshow");
	images = container.getElements("li");
	currentIndex = 0;
	var interval;

    images.each(function(img, i) {
        if (i > 0) {
            img.set("opacity", 0);
        }
    });

    var show = function() {
        images[currentIndex++].set("tween", {
            duration: 2000
        }).tween("opacity", 0);
        images[currentIndex %= images.length].set("tween", {
            duration: 2000
        }).tween("opacity", 1);
    }

    show.periodical(duration);
	getSize();
});
window.onresize = function(){
	getSize();
};

var getSize = function(){
	container.setStyle('height',images[currentIndex].getSize().y);
};
