var ims = ['./photos/William Biclke Monarch 2Web .jpg', './photos/2009_04192009cuba0375abWeb.jpg', './photos/2009_0815pond0814090048abcWeb.jpg', './photos/2009_0901wolfGolden0440Weba.jpg', './photos/2009_0807pond0806090168abWeb.jpg', './photos/xxx 165Web .jpg', './photos/2009_06062009moose0061aWeb.jpg', './photos/dragonfly  082a.jpg', './photos/Osprey  024.jpg', './photos/2009_06072009moosetrip0007aWeb.jpg'];
var imgs = [['169', './photos/William Biclke Monarch 2Web .jpg'], ['126', './photos/2009_04192009cuba0375abWeb.jpg'], ['150', './photos/2009_0815pond0814090048abcWeb.jpg'], ['112', './photos/2009_0901wolfGolden0440Weba.jpg'], ['143', './photos/2009_0807pond0806090168abWeb.jpg'], ['170', './photos/xxx 165Web .jpg'], ['132', './photos/2009_06062009moose0061aWeb.jpg'], ['100', './photos/dragonfly  082a.jpg'], ['60', './photos/Osprey  024.jpg'], ['134', './photos/2009_06072009moosetrip0007aWeb.jpg']];
window.addEvent('domready', function(){
	var slide1 = $('slide1');
	var slide2 = $('slide2');
	var plink = $('photolink');
	var effect1 = new Fx.Morph(slide1, {duration: 1000, transition: Fx.Transitions.Sine.easeOut});
	var effect2 = new Fx.Morph(slide2, {duration: 1000, transition: Fx.Transitions.Sine.easeOut});
	var periodical;
	var toggle = true;
	var i = 0;
	var inx = 0;
	var max = imgs.length - 1;
	var crossfade = function() {
		if (toggle){
			toggle = false;
			slide1.setStyles({'background': "#000000 url('"+imgs[i][1]+"') no-repeat center center", 'opacity': 0, 'z-index': 200});
			slide2.setStyle('z-index', 100);
			effect1.start({'opacity': 1.0});
			plink.set('href', 'photo.php?id='+imgs[i][0]);
		} else {
			toggle = true;
			slide2.setStyles({'background': "#000000 url('"+imgs[i][1]+"') no-repeat center center", 'opacity': 0, 'z-index': 200});
			slide1.setStyle('z-index', 100);
			effect2.start({'opacity': 1.0});
			plink.set('href', 'photo.php?id='+imgs[i][0]);
		}
		(i < max) ? i += 1: i=0;
	}
	slide1.setStyle('background', "url('images/waiting.gif') no-repeat center center");
	new Asset.images(ims, {
		onComplete: function() {
			crossfade();
			periodical = crossfade.periodical(3200);
		}
	});
});