
		var tsbSelectedTabs = new Object(), processingScrollClick = false, smoothMoving = false;
		function tsbTabClicked(tsbId, tabNumber) {
			var currentSelectedTab = tsbSelectedTabs[tsbId];
			tsbSetTabState(tsbId, tabNumber, true);
			if (currentSelectedTab != tabNumber) tsbSetTabState(tsbId, currentSelectedTab, false);
			tsbSelectedTabs[tsbId] = tabNumber;
		}
		function tsbSetTabState(tsbId, tabNumber, selected) {
			var tabDivIdBase = tsbGetTabDivIdBase(tsbId, tabNumber);
			var tabSelDivObj = document.getElementById(tabDivIdBase + "sel");
			var tabUnselDivObj = document.getElementById(tabDivIdBase + "unsel");
			var contentDivObj = tsbGetTabDiv(tsbId, tabNumber, "Content");
			if (selected == true) {
				tabSelDivObj.style.display = "block"; tabUnselDivObj.style.display = "none";
				contentDivObj.style.display = "block";}
			else {tabUnselDivObj.style.display = "block"; tabSelDivObj.style.display = "none";
				contentDivObj.style.display = "none";}
		}
		function tsbGetTabDivIdBase(tsbId, tabNumber) {
			return "tsbTab_" + tsbId + "_" + tabNumber + "_";
		}
		function tsbGetTabDiv(tsbId, tabNumber, divType) {
			return document.getElementById("tsb" + divType + "_" + tsbId + "_" + tabNumber);
		}
		function tsbGetArrowDiv(tsbId, tabNumber, arrowDivType) {
			var divId = "tsb" + arrowDivType + "Arrow_" + tsbId + "_" + tabNumber;
			return document.getElementById(divId);
		}
		function tsbMoveLeft(tsbId, scrollPixels) {
			if (processingScrollClick == true || smoothMoving == true) return false;
			else {
				processingScrollClick = true;
				var scrollDivObj = tsbGetTabDiv(tsbId, tsbSelectedTabs[tsbId], "Scroll");
				var currentPos = parseInt(scrollDivObj.style.left);
				var remainderWidth = Math.abs(currentPos), movement = 0;
				if (remainderWidth > 0) {
					movement += scrollPixels;
					var smObj = new smoothMove(scrollDivObj, currentPos + movement);}
				tsbUpdateArrowDisplay(tsbId, currentPos + movement);
				processingScrollClick = false;}
		}
		function tsbMoveRight(tsbId, scrollPixels) {
			if (processingScrollClick == true || smoothMoving == true) return false;
			else {
				processingScrollClick = true;
				var selectedTab = tsbSelectedTabs[tsbId];
				var scrollDivObj = tsbGetTabDiv(tsbId, selectedTab, "Scroll");
				var viewDivObj = tsbGetTabDiv(tsbId, selectedTab, "View");
				var currentPos = parseInt(scrollDivObj.style.left);
				var scrollDivWidth = parseInt(scrollDivObj.style.width);
				var viewDivWidth = parseInt(viewDivObj.style.width);
				var remainderWidth = scrollDivWidth - Math.abs(currentPos) - viewDivWidth, movement = 0;
				if (remainderWidth > 0) {
					movement -= scrollPixels;
					var smObj = new smoothMove(scrollDivObj, currentPos + movement);}
				tsbUpdateArrowDisplay(tsbId, currentPos + movement);
				processingScrollClick = false;}
		}
		function tsbUpdateArrowDisplay(tsbId, currentPosToUse) {
			var selectedTab = tsbSelectedTabs[tsbId];
			var leftDivObj = tsbGetArrowDiv(tsbId, selectedTab, "Left");
			var noLeftDivObj = tsbGetArrowDiv(tsbId, selectedTab, "NoLeft");
			var rightDivObj = tsbGetArrowDiv(tsbId, selectedTab, "Right");
			var noRightDivObj = tsbGetArrowDiv(tsbId, selectedTab, "NoRight");
			var scrollDivObj = tsbGetTabDiv(tsbId, selectedTab, "Scroll");
			var viewDivObj = tsbGetTabDiv(tsbId, selectedTab, "View");
			var currentPos = currentPosToUse;
			if (currentPos == null) currentPos = parseInt(scrollDivObj.style.left);
			if (Math.abs(currentPos) > 0) {
				leftDivObj.style.display = "block"; noLeftDivObj.style.display = "none";}
			else {leftDivObj.style.display = "none"; noLeftDivObj.style.display = "block";}
			var scrollDivWidth = parseInt(scrollDivObj.style.width);
			var viewDivWidth = parseInt(viewDivObj.style.width);
			if ((scrollDivWidth - Math.abs(currentPos) - viewDivWidth) > 0) {
				rightDivObj.style.display = "block"; noRightDivObj.style.display = "none";}
			else {rightDivObj.style.display = "none"; noRightDivObj.style.display = "block";}
		}
		function smoothMove(divObj, destination) {
			smoothMoving = true; this.divObj = divObj; this.destination = destination;
			this.increment = 2; this.doSmoothMove = doSmoothMove; this.doSmoothMove();
		}
		function doSmoothMove() {
			var currentPosition = parseInt(this.divObj.style.left);
			if (currentPosition == this.destination) smoothMoving = false;
			else {
				var increment, remaining = Math.abs(currentPosition - this.destination);
				increment = this.increment; if (remaining < this.increment) increment = remaining;
				if (currentPosition < this.destination) currentPosition += increment;
				else currentPosition -= increment;
				this.divObj.style.left = currentPosition + "px"; var thisObj = this;
				window.setTimeout(function(){thisObj.doSmoothMove();}, 5);}
		}
