function initScroller(gallery_id)
{
	// get panel width
	var panelWidth = $('#'+gallery_id+' .belt .panel').outerWidth();
	var position = $('#'+gallery_id+' .belt').scrollLeft();
	
	var panelCount = $('#'+gallery_id+' .belt .panel').length;
	var tWidth = panelCount*panelWidth;
	
	
	// init object
	var scroller = {
		id:gallery_id,
		width: panelWidth,
		totalWidth:tWidth,
		cssProp:'left',
		position:position,
		duration:300,
		
		setWidth:function(newWidth)
		{
			this.width = newWidth;
		},
		setTotalWidth:function(tw)
		{
			this.totalWidth = tw;
		},
		doScroll:function(gid, dir)
		{
			var
				bWillScroll = false;
				
			if(dir == 1) // right
			{
				if(this.position < 0)
				{
					bWillScroll = true;
					
					if(this.position < (0-this.width))					
						this.position+=this.width					
					else
						this.position = 0;
				}
			}
			else // left
			{
				if((0-this.position) < (this.totalWidth - this.width))
				{
					bWillScroll = true;
					
					if((0-this.position < (this.totalWidth - (this.width*2))))
						this.position-=this.width;
					else
						this.position = 0- this.totalWidth + this.width;
				}
			}
			var newPos = this.position;
			// perform move
			if(bWillScroll)
			{
				$('#'+gid+' .belt').animate({'left' : newPos+'px'}, this.duration);
				this.setActiveScrollerButtons(gid);
			}
		},
		setActiveScrollerButtons:function(gid){
			
			/*
			if(this.position < 0)			
				$('#left_'+gid).addClass("active");			
			else
				$('#left_'+gid).removeClass("active");
				
				
			if((0 - this.position) < (this.totalWidth - this.width))
				$('#right_'+gid).addClass("active");	
			else
				$('#right_'+gid).removeClass("active");	
				
			
			*/	
		}
		
	};
	scroller.setActiveScrollerButtons(gallery_id);
	return scroller;
}

