From e596db90f45967500b05ceee1ea606b31d6f858d Mon Sep 17 00:00:00 2001
From: lowercase-donkey <lowercasedonkey@gmail.com>
Date: Sun, 10 Feb 2019 15:43:22 -0500
Subject: [PATCH] Add tab memory to most buildings

---
 src/facilities/farmyard/farmyard.tw   | 50 +++++++++++---------
 src/facilities/nursery/nursery.tw     | 60 ++++++++++++-----------
 src/js/utilJS.js                      |  4 +-
 src/uncategorized/arcade.tw           | 59 +++++++++++++----------
 src/uncategorized/cellblock.tw        | 61 ++++++++++++++----------
 src/uncategorized/clinic.tw           | 59 +++++++++++++----------
 src/uncategorized/club.tw             | 59 +++++++++++++----------
 src/uncategorized/dairy.tw            | 68 +++++++++++++++------------
 src/uncategorized/headGirlSuite.tw    | 53 ++++++++++++++-------
 src/uncategorized/masterSuite.tw      | 59 +++++++++++++----------
 src/uncategorized/pit.tw              | 54 ++++++++++++++-------
 src/uncategorized/schoolroom.tw       | 60 +++++++++++++----------
 src/uncategorized/servantsQuarters.tw | 59 +++++++++++++----------
 src/uncategorized/spa.tw              | 56 +++++++++++++---------
 14 files changed, 451 insertions(+), 310 deletions(-)

diff --git a/src/facilities/farmyard/farmyard.tw b/src/facilities/farmyard/farmyard.tw
index 7e094e405e4..d46216e5007 100644
--- a/src/facilities/farmyard/farmyard.tw
+++ b/src/facilities/farmyard/farmyard.tw
@@ -469,37 +469,45 @@ $farmyardNameCaps is an oasis of growth in the midst of the jungle of steel and
 <</if>>
 <br><br>
 
-<<if ($farmyard <= $farmyardSlaves)>>
-	''$farmyardNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $farmyardSlaves)>>
-	<<link "''Send a slave to $farmyardName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($farmyard <= $farmyardSlaves)>>
+			''$farmyardNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $farmyardSlaves)>>
 			<<resetAssignmentFilter>>
 			<<set $Flag = 0>>
 			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
+		<</if>>
+	</div>
+</div>
 
-<<if $farmyardSlaves > 0>>
-	| <<link "''Bring a slave out of $farmyardName''">>
-		<<replace #ComingGoing>>
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $farmyardSlaves > 0>>
 			<<farmyardAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$farmyardNameCaps is empty for the moment.//
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.Farmyard == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$farmyardNameCaps is empty for the moment.//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
 
-<br>
-<span id="ComingGoing">
-	<<farmyardAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+</body>
 
 <br><br>Rename $farmyardName: <<textbox "$farmyardName" $farmyardName "Farmyard">> //Use a noun or similar short phrase//
diff --git a/src/facilities/nursery/nursery.tw b/src/facilities/nursery/nursery.tw
index 5a819f0bd67..f127a210b57 100644
--- a/src/facilities/nursery/nursery.tw
+++ b/src/facilities/nursery/nursery.tw
@@ -125,41 +125,47 @@ $nurseryNameCaps
 <</if>>
 
 <br><br>
-<<if ($nurseryNannies <= $nurserySlaves)>>
-	''$nurseryNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $nurserySlaves)>>
-	<<link "''Send a slave to $nurseryName''">>
-		<<replace #ComingGoing>>
-			<<resetAssignmentFilter>>
-			<<set $Flag = 0>>
-			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
 
-<<if $nurserySlaves > 0>>
-	| <<link "''Bring a slave out of $nurseryName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $nurserySlaves > 0>>
 			<<nurseryAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$nurseryNameCaps is empty for the moment.<br>//
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($nurseryNannies <= $nurserySlaves)>>
+			''$nurseryNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $nurserySlaves)>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.Nursery == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$nurseryNameCaps is empty for the moment.<br>//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
 
-<br><br>
-<<assignmentFilter >>
-<span id="ComingGoing">
-	<<nurseryAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span><br>
-
-<br>It can support $nursery child<<if $nursery != 1>>ren<</if>>. Currently $nurseryBabies rooms are in use.
+<br><br>It can support $nursery child<<if $nursery != 1>>ren<</if>>. Currently $nurseryBabies rooms are in use.
 <<if $nursery < 50>>
 	[[Add another room|Nursery][cashX(forceNeg(Math.trunc(5000*$upgradeMultiplierArcology)), "farmyard"), $nursery += 5]] //Costs <<print cashFormat(Math.trunc(5000*$upgradeMultiplierArcology))>> and will increase upkeep costs//
 	<<if $freeCribs == 0>>
diff --git a/src/js/utilJS.js b/src/js/utilJS.js
index 17611f406d2..0dcebbd2ec8 100644
--- a/src/js/utilJS.js
+++ b/src/js/utilJS.js
@@ -1340,7 +1340,7 @@ window.HSM = function() {
 window.opentab = function(evt, tabName) {
 	var i, tabcontent, tablinks;
 	const V = State.variables;
-	/*var passage = passage();*/
+	/*var passage = passage().trim().replace(/ /g,"+");*/
 	tabcontent = document.getElementsByClassName("tabcontent");
 	for (i = 0; i < tabcontent.length; i++) {
 		tabcontent[i].style.display = "none";
@@ -1349,7 +1349,7 @@ window.opentab = function(evt, tabName) {
 	for (i = 0; i < tablinks.length; i++) {
 		tablinks[i].className = tablinks[i].className.replace(" active", "");
 	}
-	V.tabChoice[passage()] = tabName;
+	V.tabChoice[passage().trim().replace(/ |'/g,"")] = tabName; /*The regex strips spaces and " ' " from passage names, making "Servants' Quarters" into "ServantsQuarters" and allowing it to be used as a label in this object. */
 	document.getElementById(tabName).style.display = "block";
 	evt.currentTarget.className += " active";
 };
\ No newline at end of file
diff --git a/src/uncategorized/arcade.tw b/src/uncategorized/arcade.tw
index 08548d45513..f1aa702f304 100644
--- a/src/uncategorized/arcade.tw
+++ b/src/uncategorized/arcade.tw
@@ -131,37 +131,46 @@ $arcadeNameCaps
 <<ArcadeStatistics 1>>
 
 <br><br>
-<<if ($arcade <= $arcadeSlaves) && $arcadeUpgradeFuckdolls == 0>>
-	''$arcadeNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $arcadeSlaves)>>
-	<<link "''Confine a slave in $arcadeName''">>
-		<<replace #ComingGoing>>
-			<<resetAssignmentFilter>>
-			<<set $Flag = 0>>
-			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
 
-<<if $arcadeSlaves > 0>>
-	| <<link "''Bring a slave out of $arcadeName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $arcadeSlaves > 0>>
 			<<arcadeAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$arcadeNameCaps is empty for the moment.<br> //
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($arcade <= $arcadeSlaves) && $arcadeUpgradeFuckdolls == 0>>
+			''$arcadeNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $arcadeSlaves)>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.Arcade == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$arcadeNameCaps is empty for the moment.<br> //
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
-<br><br>
-<<assignmentFilter>>
-<span id="ComingGoing">
-	<<arcadeAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+
+</body>
 
 <br><br>Rename $arcadeName: <<textbox "$arcadeName" $arcadeName "Arcade">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/cellblock.tw b/src/uncategorized/cellblock.tw
index 4752184b61b..1203af61554 100644
--- a/src/uncategorized/cellblock.tw
+++ b/src/uncategorized/cellblock.tw
@@ -119,37 +119,46 @@ $cellblockNameCaps
 <</if>>
 
 <br><br>
-<<if ($cellblock <= $cellblockSlaves)>>
-	''$cellblockNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $cellblockSlaves)>>
-	<<link "''Send a resistant slave to be broken in $cellblockName''">>
-		<<replace #ComingGoing>>
+
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+	<<if $cellblockSlaves > 0>>
+		<<cellblockAssignmentFilter>>
+		<<set $Flag = 1>>
+		<<include "Slave Summary">>
+		<<resetAssignmentFilter>>
+	<<else>>
+		<br><br>//$cellblockNameCaps is empty for the moment.<br>//
+	<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($cellblock <= $cellblockSlaves)>>
+			''$cellblockNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $cellblockSlaves)>>
 			<<resetAssignmentFilter>>
 			<<set $Flag = 0>>
 			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
+		<</if>>
+	</div>
+</div>
 
-<<if $cellblockSlaves > 0>>
-	| <<link "''Let a slave out of $cellblockName''">>
-		<<replace #ComingGoing>>
-			<<cellblockAssignmentFilter>>
-			<<set $Flag = 1>>
-			<<include "Slave Summary">>
-			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+<<if ($tabChoice.Cellblock == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$cellblockNameCaps is empty for the moment.<br>//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
-<br><br>
-<<assignmentFilter>>
-<span id="ComingGoing">
-	<<cellblockAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+
+</body>
 
 <br><br>Rename $cellblockName: <<textbox "$cellblockName" $cellblockName "Cellblock">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/clinic.tw b/src/uncategorized/clinic.tw
index 886f5c8886d..3e5aeaa1e43 100644
--- a/src/uncategorized/clinic.tw
+++ b/src/uncategorized/clinic.tw
@@ -141,37 +141,46 @@ $clinicNameCaps
 <</if>>
 
 <br><br>
-<<if ($clinic <= $clinicSlaves)>>
-	''$clinicNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $clinicSlaves)>>
-	<<link "''Send a slave to get treatment in $clinicName''">>
-		<<replace #ComingGoing>>
-			<<resetAssignmentFilter>>
-			<<set $Flag = 0>>
-			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
 
-<<if $clinicSlaves > 0>>
-	| <<link "''Take a slave out of $clinicName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $clinicSlaves > 0>>
 			<<clinicAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$clinicNameCaps is empty for the moment.<br>//
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($clinic <= $clinicSlaves)>>
+			''$clinicNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $clinicSlaves)>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.Clinic == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$clinicNameCaps is empty for the moment.<br>//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
-<br><br>
-<<assignmentFilter>>
-<span id="ComingGoing">
-	<<clinicAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+
+</body>
 
 <br><br>Rename $clinicName: <<textbox "$clinicName" $clinicName "Clinic">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/club.tw b/src/uncategorized/club.tw
index 48f70b6004c..b68d1366a9a 100644
--- a/src/uncategorized/club.tw
+++ b/src/uncategorized/club.tw
@@ -256,37 +256,46 @@ $clubNameCaps
 <</if>>
 
 <br><br>
-<<if ($club <= $clubSlaves)>>
-	''$clubNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $clubSlaves)>>
-	<<link "''Send a slave to slut around $clubName''">>
-		<<replace #ComingGoing>>
-			<<resetAssignmentFilter>>
-			<<set $Flag = 0>>
-			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
 
-<<if $clubSlaves > 0>>
-	| <<link "''Bring a slave out of $clubName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $clubSlaves > 0>>
 			<<clubAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$clubNameCaps is empty for the moment.<br>//
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($club <= $clubSlaves)>>
+			''$clubNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $clubSlaves)>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.Club == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$clubNameCaps is empty for the moment.<br>//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
-<br><br>
-<<assignmentFilter>>
-<span id="ComingGoing">
-	<<clubAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+
+</body>
 
 <br><br>Rename $clubName: <<textbox "$clubName" $clubName "Club">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/dairy.tw b/src/uncategorized/dairy.tw
index e26e317a512..9d92e0538c3 100644
--- a/src/uncategorized/dairy.tw
+++ b/src/uncategorized/dairy.tw
@@ -523,44 +523,54 @@ $dairyNameCaps
 <</if>>
 
 <<set _seed = $bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren>>
+
 <br><br>
-<<if ($dairy <= $dairySlaves+_seed)>>
-	''$dairyNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $dairySlaves)>>
-	<<link "''Send a slave to $dairyName''">>
-		<<replace #ComingGoing>>
-			<<resetAssignmentFilter>>
-			<<set $Flag = 0>>
-			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
+<<if _seed > 1>>
+	//In addition, _seed milking machines have biological components installed in them.//
+<<elseif _seed == 1>>
+	//In addition, one milking machine has biological components installed in it.//
 <</if>>
+<br><br>
 
-<<if $dairySlaves > 0>>
-	| <<link "''Bring a slave out of $dairyName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $dairySlaves > 0>>
 			<<dairyAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$dairyNameCaps is empty for the moment.<br>//
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($dairy <= $dairySlaves+_seed)>>
+			''$dairyNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $dairySlaves)>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.Dairy == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$dairyNameCaps is empty for the moment.<br>//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
 
-<<if _seed > 1>>
-	//In addition, _seed milking machines have biological components installed in them.//
-<<elseif _seed == 1>>
-	//In addition, one milking machine has biological components installed in it.//
-<</if>>
-<br><br>
-<<assignmentFilter>>
-<span id="ComingGoing">
-	<<dairyAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+</body>
 
 <br><br>Rename $dairyName: <<textbox "$dairyName" $dairyName "Dairy">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/headGirlSuite.tw b/src/uncategorized/headGirlSuite.tw
index 9de9910d749..4239b5368b2 100644
--- a/src/uncategorized/headGirlSuite.tw
+++ b/src/uncategorized/headGirlSuite.tw
@@ -44,25 +44,46 @@
 	$He is ''not allowed'' to customize $his slave with hormone treatments. [[Allow|Head Girl Suite][$HGSuiteHormones = 1]]
 	<</if>>
 <</if>>
+<br><br>
 
-<<if $HGSuiteSlaves > 0>>
-	<br><br>''Bring the Head Girl's girl out of $HGSuiteName:''
-	<<headgirlSuiteAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-<</if>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave to the Head Girl</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Bring the Head Girl's girl out of $HGSuiteName</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $HGSuiteSlaves > 0>>
+			<<headgirlSuiteAssignmentFilter>>
+			<<set $Flag = 1>>
+			<<include "Slave Summary">>
+			<<resetAssignmentFilter>>
+		<</if>>
+	</div>
+</div>
 
-<<if ($slaves.length > $HGSuiteSlaves) && ($HGSuiteSlaves < 1)>>
-	<br><br>''Assign a slave to the Head Girl:''
-	<br><br>
-	<<assignmentFilter>>
-	<span id="ComingGoing">
-		<<resetAssignmentFilter>>
-		<<set $Flag = 0>>
-		<<include "Slave Summary">>
-	</span>
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($slaves.length > $HGSuiteSlaves) && ($HGSuiteSlaves < 1)>>
+			<<assignmentFilter>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<<else>>
+			''Head Girl already has a girl.''
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.HeadGirlSuite == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
+<<else>>
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
 
+</body>
 
 <br><br>Rename $HGSuiteName: <<textbox "$HGSuiteName" $HGSuiteName "Head Girl Suite">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/masterSuite.tw b/src/uncategorized/masterSuite.tw
index 1928908a637..8b5891a687f 100644
--- a/src/uncategorized/masterSuite.tw
+++ b/src/uncategorized/masterSuite.tw
@@ -353,37 +353,46 @@ $masterSuiteNameCaps is furnished
 <</if>>
 
 <br><br>
-<<if ($masterSuite <= $masterSuiteSlaves)>>
-	''$masterSuiteNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $masterSuiteSlaves)>>
-	<<link "''Send a slave to serve in $masterSuiteName''">>
-		<<replace #ComingGoing>>
-			<<resetAssignmentFilter>>
-			<<set $Flag = 0>>
-			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
 
-<<if $masterSuiteSlaves > 0>>
-	| <<link "''Bring a slave out of $masterSuiteName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $masterSuiteSlaves > 0>>
 			<<suiteAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$masterSuiteNameCaps is empty for the moment//
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($masterSuite <= $masterSuiteSlaves)>>
+			''$masterSuiteNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $masterSuiteSlaves)>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.MasterSuite == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$masterSuiteNameCaps is empty for the moment//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
-<br><br>
-<<assignmentFilter>>
-<span id="ComingGoing">
-	<<suiteAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+
+</body>
 
 <br><br>Rename $masterSuiteName: <<textbox "$masterSuiteName" $masterSuiteName "Master Suite">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/pit.tw b/src/uncategorized/pit.tw
index c8576e20bcf..3049c67cee2 100644
--- a/src/uncategorized/pit.tw
+++ b/src/uncategorized/pit.tw
@@ -331,24 +331,46 @@ $pitNameCaps is clean and ready,
 	<br>
 	You have scheduled a fight to the death this week. [[Cancel it|Pit][$killChoice = -1]]
 <</if>>
+<br><br>
 
-<<if _DL > 0>>
-	<br><br>''Cancel a slave's fight:''
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-<</if>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Select a slave to fight</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Cancel a slave's fight</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if _DL > 0>>
+			<<set $Flag = 1>>
+			<<include "Slave Summary">>
+		<<else>>
+			''No slaves assigned to fight at the moment.''
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if (_SL > _DL)>>
+			<<set $Flag = 0>>
+			<<assignmentFilter>>
+			<<showallAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+			<<resetAssignmentFilter>>	
+		<</if>>
+	</div>
+</div>
 
-<<if (_SL > _DL)>>
-	<br><br>''Select a slave to fight:''
-	<<set $Flag = 0>>
-	<br><br>
-	<<assignmentFilter>>
-	<span id="ComingGoing">
-		<<showallAssignmentFilter>>
-		<<set $Flag = 0>>
-		<<include "Slave Summary">>
-		<<resetAssignmentFilter>>
-	</span>
+<<if ($tabChoice.Pit == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
+<<else>>
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
 
+</body>
+
 <br><br>Rename $pitName: <<textbox "$pitName" $pitName "Pit">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/schoolroom.tw b/src/uncategorized/schoolroom.tw
index a453f649db7..527f6de315d 100644
--- a/src/uncategorized/schoolroom.tw
+++ b/src/uncategorized/schoolroom.tw
@@ -123,36 +123,46 @@ $schoolroomNameCaps is well-equipped, with wallscreens to display lessons. These
 	You do not have a slave serving as a Schoolteacher. [[Appoint one|Schoolteacher Select]]
 <</if>>
 <br><br>
-<<if ($schoolroom <= $schoolroomSlaves)>>
-	''$schoolroomNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $schoolroomSlaves)>>
-	<<link "''Send a slave to study in $schoolroomName''">>
-		<<replace #ComingGoing>>
-			<<resetAssignmentFilter>>
-			<<set $Flag = 0>>
-			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
 
-<<if $schoolroomSlaves > 0>>
-	| <<link "''Bring a slave out of $schoolroomName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $schoolroomSlaves > 0>>
 			<<schoolAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$schoolroomNameCaps is empty for the moment.<br>//
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($schoolroom <= $schoolroomSlaves)>>
+			''$schoolroomNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $schoolroomSlaves)>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.Schoolroom == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$schoolroomNameCaps is empty for the moment.<br>//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
-<br><br>
-<<assignmentFilter>>
-<span id="ComingGoing">
-	<<schoolAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+
+</body>
+
 <br><br>Rename $schoolroomName: <<textbox "$schoolroomName" $schoolroomName "Schoolroom">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/servantsQuarters.tw b/src/uncategorized/servantsQuarters.tw
index b78bb72780c..77325f89454 100644
--- a/src/uncategorized/servantsQuarters.tw
+++ b/src/uncategorized/servantsQuarters.tw
@@ -120,37 +120,46 @@ $servantsQuartersNameCaps
 <</if>>
 
 <br><br>
-<<if ($servantsQuarters <= $servantsQuartersSlaves)>>
-	''$servantsQuartersNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $servantsQuartersSlaves)>>
-	<<link "''Send a slave to work out of $servantsQuartersName''">>
-		<<replace #ComingGoing>>
-			<<resetAssignmentFilter>>
-			<<set $Flag = 0>>
-			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
 
-<<if $servantsQuartersSlaves > 0>>
-	| <<link "''Bring a slave out of $servantsQuartersName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $servantsQuartersSlaves > 0>>
 			<<quartersAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$servantsQuartersNameCaps is empty for the moment.<br>//
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($servantsQuarters <= $servantsQuartersSlaves)>>
+			''$servantsQuartersNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $servantsQuartersSlaves)>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.ServantsQuarters == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$servantsQuartersNameCaps is empty for the moment.<br>//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
-<br><br>
-<<assignmentFilter>>
-<span id="ComingGoing">
-	<<quartersAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+
+</body>
 
 <br><br>Rename $servantsQuartersName: <<textbox "$servantsQuartersName" $servantsQuartersName "Servants' Quarters">> //Use a noun or similar short phrase//
diff --git a/src/uncategorized/spa.tw b/src/uncategorized/spa.tw
index 7fce3008f83..58a0a1b897b 100644
--- a/src/uncategorized/spa.tw
+++ b/src/uncategorized/spa.tw
@@ -127,36 +127,46 @@ $spaNameCaps
 
 
 <br><br>
-<<if ($spa <= $spaSlaves)>>
-	''$spaNameCaps is full and cannot hold any more slaves''
-<<elseif ($slaves.length > $spaSlaves)>>
-	<<link "''Let an obedient slave rest in $spaName''">>
-		<<replace #ComingGoing>>
-			<<resetAssignmentFilter>>
-			<<set $Flag = 0>>
-			<<include "Slave Summary">>
-		<</replace>>
-	<</link>>
-<</if>>
 
-<<if $spaSlaves > 0>>
-	| <<link "''Prise a slave out of $spaName''">>
-		<<replace #ComingGoing>>
+<<CreateSimpleTabs>>
+<body>
+
+<div class="tab">
+	<button class="tablinks" onclick="opentab(event, 'assign')" id="tab assign">Assign a slave</button>
+	<button class="tablinks" onclick="opentab(event, 'remove')" id="tab remove">Remove a slave</button>
+</div>
+
+<div id="remove" class="tabcontent">
+	<div class="content">
+		<<if $spaSlaves > 0>>
 			<<spaAssignmentFilter>>
 			<<set $Flag = 1>>
 			<<include "Slave Summary">>
 			<<resetAssignmentFilter>>
-		<</replace>>
-	<</link>>
+		<<else>>
+			<br><br>//$spaNameCaps is empty at the moment.<br>//
+		<</if>>
+	</div>
+</div>
+
+<div id="assign" class="tabcontent">
+	<div class="content">
+		<<if ($spa <= $spaSlaves)>>
+			''$spaNameCaps is full and cannot hold any more slaves''
+		<<elseif ($slaves.length > $spaSlaves)>>
+			<<resetAssignmentFilter>>
+			<<set $Flag = 0>>
+			<<include "Slave Summary">>
+		<</if>>
+	</div>
+</div>
+
+<<if ($tabChoice.Spa == "assign")>>
+	<script>document.getElementById("tab assign").click();</script>
 <<else>>
-	<br><br>//$spaNameCaps is empty at the moment.<br>//
+	<script>document.getElementById("tab remove").click();</script>
 <</if>>
 
-<span id="ComingGoing">
-	<<spaAssignmentFilter>>
-	<<set $Flag = 1>>
-	<<include "Slave Summary">>
-	<<resetAssignmentFilter>>
-</span>
+</body>
 
 <br><br>Rename $spaName: <<textbox "$spaName" $spaName "Spa">> //Use a noun or similar short phrase//
-- 
GitLab