function setCfList (obj) {
		if (obj.checked) {
			if (cfListCt>0 && cfListCt < 5) {
				cfList += ','+obj.value
			} else if (cfListCt > 0) { 
				alert('COMPARISON LIMITED TO FIVE ITEMS\n\nPlease click \"Show Comparison\" for a comparison\nof items '+cfList+' or\nreplace an item by unchecking it and\nchoosing another.');
				obj.checked = false;
				return;
			} else { 
				cfList = ''+obj.value;
			};
			cfListCt += 1;
		} else {                  // uncheck a checked box
			if (cfListCt>0) {
				if (cfList.indexOf(","+obj.value) > 0) {
					cfList = cfList.replace(','+obj.value,'');     // non-first element
				} else if (cfList.indexOf(obj.value) == 0) {
					if (cfListCt==1) {
						cfList = '.';                              // first and only element
					} else {
						cfList = cfList.replace(obj.value+',',''); // first of several elements
					};
				};
				cfListCt -= 1;

			} else {              // belt&suspenders if boxes and counts disagree
				cfList = '.';
				cfListCt = 0;
			};			
		};
		setComparetext();
	};
	
function setComparetext() {
		if (cfList.length == 0) {
			document.getElementById('compareitems').innerHTML = '';
		} else if (cfListCt == 0) {
			msg="NO COMPARISON SPECIFIED\n\nYou must check from two to five boxes\nnext to Item IDs in order to request a\nfull-details comparison.";
			document.getElementById('compareitems').innerHTML = '<table><tr valign="top"><td><form action="javascript:void(0)"><input type="submit" value="COMPARE" class="menulinkg" onClick="alert(msg);">&nbsp;</form></td><td><strong>To compare the full specifications of selected items,</strong><br>choose up to five items by checking the boxes next to their Item IDs.</td></tr></table>';
		} else if (cfListCt == 1) { 
			msg="NO COMPARISON SPECIFIED\n\nYou must check from two to five boxes\nnext to Item IDs in order to request a\nfull-details comparison.";
			document.getElementById('compareitems').innerHTML = '<table><tr valign="top"><td><form action="javascript:void(0)"><input type="submit" value="COMPARE" class="menulinkg" onClick="alert(msg);">&nbsp;</form></td><td><strong>To compare Item ' + cfList + '</strong> with up to four other items,<br>choose them by checking the boxes next to their Item IDs.</td></tr></table>'
		} else if (cfListCt == 5) {
			document.getElementById('compareitems').innerHTML = '<table><tr valign="top"><td><form action="javascript:postCf()"><input type="submit" value="COMPARE" class="HL">&nbsp;</form></td><td>the full details of Items <strong>' + cfList + '</strong>.<br><em>You have selected the maximum number of items to compare.</em></td></tr></table>'
		} else  {
			var cfLeftCt = 5-cfListCt;
			document.getElementById('compareitems').innerHTML = '<table><tr valign="top"><td><form action="javascript:postCf()"><input type="submit" value="COMPARE" class="HL">&nbsp;</form></td><td>the full details of Items <strong>' + cfList + '</strong>,<br><em>or add '+(cfLeftCt>1?'up to ':'')+'<strong>' + cfLeftCt + '</strong> other item'+(cfLeftCt>1?'s by checking the boxes next to their Item IDs':' by checking the box next to its Item ID')+'.</em></td></tr></table>'
		};
		if (document.getElementById('compareitems2'))
		document.getElementById('compareitems2').innerHTML = document.getElementById('compareitems').innerHTML;
	};
		
	function postCf() {
		window.location = "CompareItems.cfm?cfList=" + cfList;
	};		
