//if(typeof(Utils)=='undefined')		throw 'Az InSlideShowRoller osztály használatához a Utils betöltése szükséges';
//if(typeof(InSlideShow)=='undefined')throw 'Az InSlideShowRoller osztály használatához a InSlideShow betöltése szükséges';

var InSlideShowRoller={
	Create : function(slideIndex){
		var element=Utils.createElement('div');
		var slideShow=SlideShowLoader.slideShows[slideIndex].Slide;

		Utils.setStyle(element,
			{
				'background' : slideShow.canvasColor,
				'position'   : 'relative',
				'textAlign'  : 'left',
				'zIndex'     : slideShow.zIndex+1
			}
		);

		return element;
	},

	autoScroll : function(slideIndex){
		var slideShow=SlideShowLoader.slideShows[slideIndex].Slide;
		if(slideShow.doAuto){
			if(slideShow.current==slideShow.images.length-1) slideShow.autodir=-1;
			slideShow.current+=slideShow.autodir;
			InSlideShowRoller.scrollTo(slideIndex,slideShow.imgleft[slideShow.current]);
		}
		slideShow.autoTimeout=setTimeout('InSlideShowRoller.autoScroll('+slideIndex+')',slideShow.autoDelay);
	},

	scrollTo : function(slideIndex,x){
		var slideShow=SlideShowLoader.slideShows[slideIndex].Slide;
		slideShow.tmppos=slideShow.pos;
		if(x>=slideShow.maxpos){
			slideShow.pos=slideShow.maxpos;
			slideShow.autodir=-1;
		} else if(x<=0){
			slideShow.pos=0;
			slideShow.autodir=1;
		} else slideShow.pos=x;
		this.scroll(slideIndex);
	},

	scroll : function(slideIndex){
		var slideShow=SlideShowLoader.slideShows[slideIndex].Slide;
		if(Math.abs(slideShow.tmppos-slideShow.pos)>0.2){
			slideShow.tmppos=slideShow.tmppos+((slideShow.pos-slideShow.tmppos)/6);
			slideShow.roller.style.left=-slideShow.tmppos+'px';
			slideShow.autoTimeout=setTimeout('InSlideShowRoller.scroll('+slideIndex+')',50);
		}
	},

	ScrollLeft : function(slideIndex){
		var slideShow=SlideShowLoader.slideShows[slideIndex].Slide;

		clearTimeout(slideShow.timeout);
		if(slideShow.current>0) slideShow.current--;
		InSlideShowRoller.scrollTo(slideIndex,slideShow.imgleft[slideShow.current]);
		slideShow.autodir=-1;
	},

	ScrollRight : function(slideIndex){
		var slideShow=SlideShowLoader.slideShows[slideIndex].Slide;

		clearTimeout(slideShow.timeout);
		if(slideShow.current<slideShow.images.length-1) slideShow.current++;
		InSlideShowRoller.scrollTo(slideIndex,slideShow.imgleft[slideShow.current]);
		slideShow.autodir=1;
	}
}