FeaturedSlideshow = new Class({
		initialize: function(el, data)
		{
			this.data = data;
			this.div = document.getElementById(el);
			this.img = this.div.getElementsByTagName('img')[0];
			this.img2 = this.div.getElementsByTagName('img')[1];
			
			this.index = 0;
			this.transition.delay(5000, this, new Array(this.img, this.img2));
		},
		transition: function(img, img2)
		{
			this.index++;
			if(this.index >= this.data.length)
			{
				this.index = 0;
			}
			var next = this.data[this.index];
			
			img.src = next.src;
			img.title = next.caption;
			img.alt = next.caption;
			img.onclick = this.clicked.bind(this, next.href);
			img.style.display = 'block';
			
			var myFx = new Fx.Elements(new Array(img, img2), {duration: 3000, fps: 500,
			onComplete: this.transitionFinish.bind(this, new Array(img, img2))}).start({
					'0': {
						'opacity': [0,1]
					},
					'1': {
						'opacity': [1,0]
					}
				});		
		},
		clicked: function(href)
		{
			window.location.href = href;
		},
		transitionFinish: function(img, img2)
		{
			img2.style.display = 'none'; 
			this.transition.delay(5000, this, new Array(img2, img));
		}
		
});
