Index: lib/style/skins/semtools/resultset.xsl
===================================================================
--- lib/style/skins/semtools/resultset.xsl	(revision 5780)
+++ lib/style/skins/semtools/resultset.xsl	(revision 5781)
@@ -42,6 +42,9 @@
 	
 	<xsl:param name="labelWidth">120</xsl:param>
 	
+	<xsl:param name="showAdd">true</xsl:param>
+	<xsl:param name="showRemove">true</xsl:param>	
+	
 	<xsl:template match="/">
 		<html>
 			<head>
@@ -119,6 +122,53 @@
 					<!-- citation -->
 					<xsl:call-template name="citation"/>
 					
+					<!-- edit cart, TODO: reflect status of cart contents -->
+					<xsl:if test="$showAdd = 'true'">
+						<a href="javascript:donothing()">
+							<xsl:attribute name="id">
+								<xsl:text>add_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>
+							</xsl:attribute>
+							<xsl:attribute name="onclick">
+								var params = 
+									{
+										'action': 'editcart',
+										'docid': '<xsl:value-of select="./docid"/>',
+										'operation': 'add',
+										'qformat': 'semtools'
+									};
+								load(
+									'<xsl:value-of select="$contextURL" />/metacat', //url
+									params, //params
+									'<xsl:text>add_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>' // div 
+									);
+								loadCart();	
+							</xsl:attribute>
+							Add to cart
+						</a>
+					</xsl:if>
+					<xsl:if test="$showRemove = 'true'">
+						<a href="javascript:donothing()">
+							<xsl:attribute name="id">
+								<xsl:text>remove_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>
+							</xsl:attribute>
+							<xsl:attribute name="onclick">
+								var params = 
+									{
+										'action': 'editcart',
+										'docid': '<xsl:value-of select="./docid"/>',
+										'operation': 'remove',
+										'qformat': 'semtools'
+									};
+								load(
+									'<xsl:value-of select="$contextURL" />/metacat', //url
+									params, //params
+									'<xsl:text>remove_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>' // div 
+									);
+								loadCart();	
+							</xsl:attribute>
+							Remove from cart
+						</a>
+					</xsl:if>	
 				</div>
 				
 				<!-- the content part -->	
Index: lib/style/skins/semtools/index.jsp
===================================================================
--- lib/style/skins/semtools/index.jsp	(revision 5780)
+++ lib/style/skins/semtools/index.jsp	(revision 5781)
@@ -308,6 +308,79 @@
 	return false;
 	
 }
+function loadCart() {
+
+	// start the busy indicator
+	$("#cartResults").busy(
+			{
+				position	: 'left', 
+				offset		: -30, 
+				hide		: true, 
+				img			: "<%=STYLE_COMMON_URL%>/jquery/busy/busy.gif" 
+			});
+	
+	// for looking up the cart
+	var params = 
+	{
+		'action': 'getcart',
+		'showAdd': 'false',
+		'showRemove': 'true',
+		'qformat': 'semtools'
+	};
+	//load the cart results
+	$("#cartResults").load(
+		"<%=SERVLET_URL%>" + " #content_wrapper",
+		params,
+		// call back function when loading finishes
+		function(response, status, xhr) {
+			if (status == "error") {
+				var msg = "Sorry but there was an error performing the search: ";
+				$("#error").html(msg + xhr.status + " " + xhr.statusText);
+			}
+			// collapsible search results - show and hide the next div
+			$(function() {
+				$('.accordian').click(function() {
+					var ref = $(this);
+					$(this).parent().next().slideToggle(
+						"slow",
+						function() {
+							if ($(ref).parent().next().is(":visible")) {
+								$(ref).html("-");
+							} else {
+								$(ref).html("+");
+							}
+						});
+					return false;
+				}).parent().next().hide();
+			});
+			
+			// stop the busy indicator
+			$("#cartResults").busy("hide");
+		});
+	return true;
+}
+function clearCart() {
+
+	// for looking up the cart
+	var params = 
+	{
+		'action': 'editcart',
+		'operation': 'clear',
+		'qformat': 'semtools'
+	};
+	// post the cart clear
+	$("#cartResults").load(
+		"<%=SERVLET_URL%>",
+		params,
+		// call back function when loading finishes
+		function(response, status, xhr) {
+			if (status == "error") {
+				var msg = "Sorry but there was an error clearing the cart: ";
+				$("#error").html(msg + xhr.status + " " + xhr.statusText);
+			}
+		});
+	return true;
+}
 function clearForm() {
 	// clear the form values
 	$('#searchForm').get(0).reset();
@@ -366,6 +439,7 @@
 function pageLoad() {
 	initialize();
 	doSearch($('#searchForm').get(0));
+	//loadCart();
 }
 function donothing() {}
 --></script>
@@ -403,6 +477,8 @@
 	<input name="query" type="hidden" />
 	<input name="qformat" value="semtools" type="hidden" />
 	<input name="includeHeader" value="false" type="hidden" />
+	<input name="showAdd" value="true" type="hidden" />
+	<input name="showRemove" value="false" type="hidden" />
 	<input name="action" value="semquery" type="hidden" />
 
 	<!-- tabs for the search interface -->		
@@ -547,6 +623,26 @@
 	
 	<br/>
 	
+	<!--cart here -->	
+	<table class="subGroup subGroup_border onehundred_percent">
+		<tr>
+			<th>
+				Cart
+				<input type="button" value="Refresh" onclick="loadCart()"/>
+				<input type="button" value="Remove all" onclick="clearCart(); loadCart()"/>
+			</th>
+		</tr>
+		<tr>
+			<td>
+				<div id="cartResults">
+				No items in cart
+				</div>
+			</td>
+		</tr>
+	</table>
+
+	<br/>
+
 	<!-- search results here -->	
 	<table class="subGroup subGroup_border onehundred_percent">
 		<tr>
