function PhotoSlider(images,delay) {
	this.idx=0;
	this.fx=Array();
	this.fx.push(new Fx.Slide(images[0],{duration:600}));
	for(var i = 1;i < images.length;i++)
		this.fx.push(new Fx.Slide(images[i],{duration:600}).hide());
		
	var self=this;
	setInterval(function(){self.Load();},delay);	
}
PhotoSlider.prototype.Load = function() {
	this.fx[this.idx].toggle();
	this.idx = this.Next();
	this.fx[this.idx].toggle();
}
PhotoSlider.prototype.Next = function() {
    return this.idx + 1 == this.fx.length ? 0 : this.idx + 1;
}

function PhotoFader(images,delay) {
	this.idx=0;
	this.fx=Array();
	this.fx.push(new Fx.Style(images[0],'opacity',{duration:600}));
	for(var i = 1;i < images.length;i++)
		this.fx.push(new Fx.Style(images[i],'opacity',{duration:600}).set(0));
		
	var self=this;
	setInterval(function(){self.Load();},delay);	
}
PhotoFader.prototype.Load = function() {
	this.fx[this.idx].start(0);
	this.idx = this.Next();
	this.fx[this.idx].start(1);
}
PhotoFader.prototype.Next = function() {
    return this.idx + 1 == this.fx.length ? 0 : this.idx + 1;
}

function ContentSwapper(items,selected) {
	this.cur=null;
	this.fx=Array();
	for(var i = 0;i < items.length;i++)
	{
		this.fx.push(new Fx.Slide(items[i],{duration:600}));
		if(i != selected) { this.fx[i].hide(); } else { this.cur=i; }
	}
}
ContentSwapper.prototype.Swap = function(idx) {
	if(this.cur != idx) {
	if(this.cur != null)
		this.fx[this.cur].slideOut();
	this.fx[this.cur=idx].slideIn();
	}
}

function StyleChanger(item,attribute,dur,delay,list) {
	this.idx = 0;
	this.list = list;
	this.fx = new Fx.Style(item,attribute,{duration:dur});
	var self=this;
	setInterval(function(){self.Load();},delay);	
}
StyleChanger.prototype.Load = function() {
	this.idx=this.Next();
	this.fx.start(this.list[this.idx]);
}
StyleChanger.prototype.Next = function() {
    return this.idx + 1 == this.list.length ? 0 : this.idx + 1;
}

