function cwpCategoryScroller(containerSel, listSel, lArrowSel, rArrowSel, animIncrement){
	this.containerDiv = $(containerSel);
	this.internalDiv = $(listSel);
	this.lArrow = $(lArrowSel);
	this.rArrow = $(rArrowSel);
	this.subWidth = 0;
	this.animIncrement = (animIncrement)?animIncrement:50;
	this.frameInnerWidth = 0;
	this.marginLeft = -1;
	this.keepScrollingLeft = false;
	this.keepScrollingRight = false;
	this.disabledClass = "cwpDisabled";
	this.selectedClass = "cwpSelected";

	obj = this;
	this.calcSize = function(){
		obj.subWidth = 0;
		$.each(obj.internalDiv.children(),function(i,elem){
			//alert(i + " - '" + $(this).html() + "' = " + $(this).outerWidth());
			obj.subWidth += $(this).outerWidth();
		});
		obj.frameInnerWidth = obj.containerDiv.innerWidth();
		if (obj.frameInnerWidth < obj.subWidth){
			obj.rArrow.removeClass(obj.disabledClass); // disable the right arrow, since there is no scrolling
			obj.internalDiv.css("width", obj.subWidth);
		} else {
			obj.rArrow.addClass(obj.disabledClass); // disable the right arrow, since there is no scrolling
			obj.marginLeft = obj.frameInnerWidth - obj.subWidth;
		}
		// If we've ended up with a smaller list than the scrollable area
		if (obj.marginLeft > -1){
			obj.lArrow.addClass(obj.disabledClass); // disable the left arrow
			obj.marginLeft = -1;

		// If the end of the list no longer lines up with the right border, shift it
		} else if (obj.marginLeft + (obj.subWidth - obj.frameInnerWidth) < -1) {
			obj.rArrow.addClass(obj.disabledClass); // disable the right arrow, since there is no scrolling
			obj.marginLeft = -(obj.subWidth - obj.frameInnerWidth);
		}
		obj.internalDiv.css("marginLeft", obj.marginLeft);
	}

	this.lArrow.addClass(obj.disabledClass); // disable the left arrow (it always starts disabled)
	this.calcSize(); // do the initial sizing
	$(document).bind('emchange',this.calcSize); // recalculate the sizing when text changes size

	this.lArrow.mousedown(function(){
		obj.keepScrollingLeft = true;
		obj.lArrow.addClass(obj.selectedClass);
		obj.scrollLeft();
	});
	this.lArrow.mouseup(function(){
		obj.lArrow.removeClass(obj.selectedClass);
		obj.keepScrollingLeft = false;
	});
	this.rArrow.mousedown(function(){
		obj.keepScrollingRight = true;
		obj.rArrow.addClass(obj.selectedClass);
		obj.scrollRight();
	});
	this.rArrow.mouseup(function(){
		obj.rArrow.removeClass(obj.selectedClass);
		obj.keepScrollingRight = false;
	});

	this.scrollLeft = function(){
		if (obj.keepScrollingLeft){
			if (obj.marginLeft < -1){
				var diff = obj.marginLeft + obj.subWidth - obj.frameInnerWidth;
				if (diff == 0) obj.rArrow.removeClass(obj.disabledClass);
				obj.marginLeft += ((-obj.marginLeft-1)<obj.animIncrement)?-obj.marginLeft-1:obj.animIncrement;
				obj.internalDiv.animate({marginLeft: obj.marginLeft}, 500, "linear", obj.scrollLeft);
			}else{
				obj.keepScrollingLeft = false;
				obj.lArrow.removeClass(obj.selectedClass);
				obj.lArrow.addClass(obj.disabledClass);
			}
		}
	}

	this.scrollRight = function(){
		if (obj.keepScrollingRight){
			var diff = obj.marginLeft + obj.subWidth - obj.frameInnerWidth;
			if (diff > 0){
				if (obj.marginLeft == -1) obj.lArrow.removeClass(obj.disabledClass);
				obj.marginLeft += (diff<obj.animIncrement)?-diff:-obj.animIncrement;
				obj.internalDiv.animate({marginLeft: obj.marginLeft}, 500, "linear", obj.scrollRight);
			}else{
				obj.keepScrollingRight = false;
				obj.rArrow.removeClass(obj.selectedClass);
				obj.rArrow.addClass(obj.disabledClass);
			}
		}
	}
}
