var imageTimer = new Class({
	initialize: function(items, delayTime)
	{
		this.items = $$(items);
		this.isPlay = true;
		this.item = 0;
		this.delayT = delayTime;
		this.cur=this.item;
		this.next=false;
		this.isPush=false;
		this.moveDelay = delayTime;
		this.set();
	},
	set: function()
	{
		for(i=0; i<this.items.length; i++)
		{
			if(this.item==i) this.items[i].setStyle('display', 'block');
			else this.items[i].setStyle('display', 'none');
		}
		this.play();
		

	},
	play: function()
	{
		if(this.isPlay) {
			if(this.isPush) {
				this.timer = this.set.delay(this.delayT, this);
				this.isPush =false;
			}else {
				this.items[this.cur].setStyle('display','none');
				this.items[this.item].setStyle('display','block');
				if(this.next) {
					this.cur = this.item;
					this.item++;
					if(this.item>=this.items.length) this.item=0;
				}
				this.next=true;
				this.timer = this.set.delay(this.delayT, this);
			}	
		}
		
	},
	stop : function()
	{
		$clear(this.timer);
		this.isPlay=false;
		this.isPush=true;
	},
	start : function()
	{
		this.isPlay=true;
		$clear(this.timer);
		this.play();
	},
	prevBtn: function()
	{
		this.cur = this.item;
		this.item--;
		if(this.item < 0 ) this.item=this.items.length-1;
		$clear(this.timer);
		this.set();
	},
	nextBtn: function()
	{
		this.cur = this.item;
		this.item++;
		if(this.item >= this.items.length) this.item=0;
		$clear(this.timer);
		this.set();	
	}
});

