
 var offerFader = new Class({
	initialize:function(main_id,page_class)
	{
		this.main = $(main_id);
		this.pages = $$(page_class);
		this.counter = 0;
		this.stop = false;
		var $this = this;
		this.timer = false;
		if(this.pages.length<1)
			return
		this.pages.each(function(page,index){
			page.addEvents({
				'mouseenter':function(){
					$this.stop = true;
				},
				'mouseleave':function(){
					$this.stop = false;
				}
			});
			
			page.setStyle('opacity',0);
			if(index==0)
			{
				page.setStyle('z-index',1100);
				page.setStyle('opacity',1);
			}
			page.setStyle('display','block');
			page.setStyle('z-index',(100+index));
			page.fx = new Fx.Tween(page,{duration:2000});
		})
		this.setAutoscroll();
	},
	switchSlide:function(curr)
	{
		var setCounter;
		if(curr+1<this.pages.length)
		{
			var next = curr+1;
			setCounter = next;
		}
		if(curr+1>=this.pages.length)
		{
			var next = 0;
			setCounter = 0;
		}
		
		var $this = this;
		this.pages[next].setStyles({
			'z-index':'99'
		});
		this.pages[curr].setStyle('z-index','200');
		this.pages[curr].fx.start('opacity',0);
		this.pages[next].fx.start('opacity',1);
		$this.counter = setCounter;
	},
	setAutoscroll:function()
	{
		var $this = this;
		this.interval = function(){
			if($this.stop)
				return;
			else
				$this.switchSlide($this.counter);
		}
		this.interval.periodical(10000)
	}
})