slidingImg = new Class(
	{
		initialize : function(slidearea,wrap,prev,next,autoplay)
			{
				this.slidearea = slidearea;
				this.wrap = wrap;
				this.prev = prev;
				this.next = next;
				this.images = $(slidearea).getElements('div.tab');
				$(this.slidearea).setStyles({overflow:'hidden',position:'relative'});
				var wrap_x = 0;
				this.x = $(this.slidearea).getSize().x;
				this.y = $(this.slidearea).getSize().y;
				Array.each(this.images, function(i)
					{
						i.setStyles({height:+this.y+'px',float:'left',display:'block'});
						wrap_x += i.getSize().x;
					}, this);
				this.wrap_x = wrap_x;
				$(this.wrap).setStyles({
						position:'absolute',
						width:this.wrap_x+'px',
						top:0,
						left:0
					});
				this.slidefx = new Fx.Scroll(this.slidearea, {duration:500});
				this.prevfx = new Fx.Morph(this.prev, {duration:700});
				this.nextfx = new Fx.Morph(this.next, {duration:700});
				this.slidefx.set(0,0);
				this.slidePoint = 0;
				$(this.prev).addEvent('click', function(e) {e.stop(); this.goPrev(); }.bind(this));
				$(this.next).addEvent('click', function(e) {e.stop(); this.goNext(); }.bind(this));
				//console.log('point='+this.slidePoint +' wrap_x='+ this.wrap_x+' slidearea='+this.x);
				if (this.slidePoint == 0) { this.hidePrev() }
				if (this.wrap_x < this.x) { this.hideNext(); this.hidePrev(); }
				if (autoplay) (function() { this.goNext(); }).periodical(7000, this);
			},
		goNext : function()
			{
				if (this.slidePoint + this.x < this.wrap_x) {
					if (this.slidePoint > this.wrap_x-150) this.slidePoint = this.wrap_x;
					else this.slidePoint += 150;
					this.slidefx.start(this.slidePoint,0);
					if (this.slidePoint != 0)
						{
							this.showPrev()
							if (this.slidePoint+this.x > this.wrap_x) this.hideNext()
						}
					//console.log('point='+this.slidePoint +' wrap_x='+ this.wrap_x+' slidearea='+this.x); 
					}
			},
		goPrev : function()
			{
				if (this.slidePoint != 0) {
					if (this.slidePoint <= 150) this.slidePoint = 0;
					else this.slidePoint -= 150;
					this.slidefx.start(this.slidePoint,0);
					if (this.slidePoint == 0) { this.hidePrev() }
					if (this.slidePoint+this.x < this.wrap_x) this.showNext()
					//console.log('point='+this.slidePoint +' wrap_x='+ this.wrap_x+' slidearea='+this.x); 
					}
			},
		hidePrev : function() { if ($(this.prev).getStyle('opacity') != 0) this.prevfx.start({opacity : 0}); },
		showPrev : function() { if ($(this.prev).getStyle('opacity') != 1) this.prevfx.start({opacity : 1}); },
		hideNext : function() { if ($(this.next).getStyle('opacity') != 0) this.nextfx.start({opacity : 0}); },
		showNext : function() { if ($(this.next).getStyle('opacity') != 1) this.nextfx.start({opacity : 1}); }
	});

